/**
 * This file was generated by kysely-codegen.
 * Please do not edit it manually.
 */

import type { ColumnType } from 'kysely';

export type Generated<T> =
  T extends ColumnType<infer S, infer I, infer U>
    ? ColumnType<S, I | undefined, U>
    : ColumnType<T, T | undefined, T>;

export type Int8 = ColumnType<
  string,
  bigint | number | string,
  bigint | number | string
>;

export type Json = JsonValue;

export type JsonArray = JsonValue[];

export type JsonObject = {
  [x: string]: JsonValue | undefined;
};

export type JsonPrimitive = boolean | number | string | null;

export type JsonValue = JsonArray | JsonObject | JsonPrimitive;

export type Timestamp = ColumnType<Date, Date | string, Date | string>;

export interface Announcements {
  archivedAt: Timestamp | null;
  audience: Generated<string>;
  color: string;
  content: Json;
  createdAt: Generated<Timestamp>;
  creatorId: string | null;
  endsAt: Timestamp | null;
  id: Generated<string>;
  isDismissible: Generated<boolean>;
  lastUpdatedById: string | null;
  startsAt: Generated<Timestamp>;
  textContent: string;
  title: string;
  tsv: string | null;
  type: string;
  updatedAt: Generated<Timestamp>;
  workspaceId: string;
}

export interface ApiKeys {
  createdAt: Generated<Timestamp>;
  deletedAt: Timestamp | null;
  expiresAt: Timestamp | null;
  id: Generated<string>;
  lastUsedAt: Timestamp | null;
  name: string | null;
  scopes: Generated<Json>;
  updatedAt: Generated<Timestamp>;
  creatorId: string;
  workspaceId: string;
}

export interface Attachments {
  aiChatId: string | null;
  createdAt: Generated<Timestamp>;
  creatorId: string;
  deletedAt: Timestamp | null;
  fileExt: string;
  fileName: string;
  filePath: string;
  fileSize: Int8 | null;
  id: Generated<string>;
  indexedAt: Timestamp | null;
  mimeType: string | null;
  pageId: string | null;
  spaceId: string | null;
  templateId: string | null;
  textContent: string | null;
  tsv: string | null;
  type: string | null;
  updatedAt: Generated<Timestamp>;
  workspaceId: string;
}

export interface Audit {
  actorId: string | null;
  actorType: Generated<string>;
  changes: Json | null;
  createdAt: Generated<Timestamp>;
  event: string;
  id: Generated<string>;
  ipAddress: string | null;
  metadata: Json | null;
  resourceId: string | null;
  resourceType: string;
  spaceId: string | null;
  userAgent: string | null;
  workspaceId: string;
}

export interface AuthAccounts {
  authProviderId: string | null;
  createdAt: Generated<Timestamp>;
  deletedAt: Timestamp | null;
  id: Generated<string>;
  providerUserId: string;
  updatedAt: Generated<Timestamp>;
  userId: string;
  workspaceId: string;
}

export interface AuthProviders {
  allowSignup: Generated<boolean>;
  createdAt: Generated<Timestamp>;
  creatorId: string | null;
  deletedAt: Timestamp | null;
  id: Generated<string>;
  isEnabled: Generated<boolean>;
  groupSync: Generated<boolean>;
  ldapBaseDn: string | null;
  ldapBindDn: string | null;
  ldapBindPassword: string | null;
  ldapTlsCaCert: string | null;
  ldapTlsEnabled: Generated<boolean | null>;
  ldapUrl: string | null;
  ldapUserAttributes: Json | null;
  ldapUserSearchFilter: string | null;
  ldapConfig: Json | null;
  settings: Json | null;
  name: string;
  oidcClientId: string | null;
  oidcClientSecret: string | null;
  oidcIssuer: string | null;
  samlCertificate: string | null;
  samlUrl: string | null;
  type: string;
  updatedAt: Generated<Timestamp>;
  workspaceId: string;
}

export interface Backlinks {
  createdAt: Generated<Timestamp>;
  id: Generated<string>;
  sourcePageId: string;
  targetPageId: string;
  updatedAt: Generated<Timestamp>;
  workspaceId: string;
}

export interface BasePendingConversions {
  conversionKey: string;
  createdAt: Generated<Timestamp>;
  pageId: string;
  workspaceId: string;
}

export interface BaseProperties {
  createdAt: Generated<Timestamp>;
  deletedAt: Timestamp | null;
  id: Generated<string>;
  isPrimary: Generated<boolean>;
  name: string;
  pageId: string;
  pendingType: string | null;
  pendingTypeOptions: Json | null;
  pendingToken: string | null;
  position: string;
  schemaVersion: Generated<number>;
  type: string;
  typeOptions: Json | null;
  updatedAt: Generated<Timestamp>;
  workspaceId: string;
}

export interface BaseRows {
  cells: Generated<Json>;
  createdAt: Generated<Timestamp>;
  creatorId: string | null;
  deletedAt: Timestamp | null;
  id: Generated<string>;
  lastUpdatedById: string | null;
  pageId: string;
  position: string;
  updatedAt: Generated<Timestamp>;
  workspaceId: string;
}

export interface BaseViewShares {
  access: Generated<string>;
  createdAt: Generated<Timestamp>;
  creatorId: string | null;
  id: Generated<string>;
  key: string;
  pageId: string;
  updatedAt: Generated<Timestamp>;
  viewId: string;
  workspaceId: string;
}

export interface BaseViews {
  config: Generated<Json>;
  createdAt: Generated<Timestamp>;
  creatorId: string | null;
  id: Generated<string>;
  name: string;
  pageId: string;
  position: string;
  type: Generated<string>;
  updatedAt: Generated<Timestamp>;
  workspaceId: string;
}

export interface Billing {
  amount: Int8 | null;
  billingScheme: string | null;
  cancelAt: Timestamp | null;
  cancelAtPeriodEnd: boolean | null;
  canceledAt: Timestamp | null;
  createdAt: Generated<Timestamp>;
  currency: string | null;
  deletedAt: Timestamp | null;
  endedAt: Timestamp | null;
  id: Generated<string>;
  interval: string | null;
  metadata: Json | null;
  periodEndAt: Timestamp | null;
  periodStartAt: Timestamp;
  planName: string | null;
  quantity: Int8 | null;
  status: string;
  stripeCustomerId: string | null;
  stripeItemId: string | null;
  stripePriceId: string | null;
  stripeProductId: string | null;
  stripeSubscriptionId: string;
  tieredFlatAmount: Int8 | null;
  tieredUnitAmount: Int8 | null;
  tieredUpTo: string | null;
  updatedAt: Generated<Timestamp>;
  workspaceId: string;
}

export interface Comments {
  content: Json | null;
  createdAt: Generated<Timestamp>;
  creatorId: string | null;
  deletedAt: Timestamp | null;
  editedAt: Timestamp | null;
  id: Generated<string>;
  lastEditedById: string | null;
  pageId: string;
  parentCommentId: string | null;
  resolvedAt: Timestamp | null;
  resolvedById: string | null;
  selection: string | null;
  spaceId: string;
  type: string | null;
  updatedAt: Generated<Timestamp>;
  workspaceId: string;
}

export interface Favorites {
  id: Generated<string>;
  userId: string;
  pageId: string | null;
  spaceId: string | null;
  templateId: string | null;
  type: string;
  workspaceId: string;
  createdAt: Generated<Timestamp>;
}

export interface FileTasks {
  createdAt: Generated<Timestamp>;
  creatorId: string | null;
  deletedAt: Timestamp | null;
  errorMessage: string | null;
  fileExt: string | null;
  fileName: string;
  filePath: string;
  fileSize: Int8 | null;
  id: Generated<string>;
  metadata: Json | null;
  pageId: string | null;
  source: string | null;
  spaceId: string | null;
  status: string | null;
  type: string | null;
  updatedAt: Generated<Timestamp>;
  workspaceId: string;
}

export interface Groups {
  createdAt: Generated<Timestamp>;
  creatorId: string | null;
  deletedAt: Timestamp | null;
  description: string | null;
  id: Generated<string>;
  isDefault: boolean;
  isExternal: Generated<boolean>;
  name: string;
  scimExternalId: string | null;
  updatedAt: Generated<Timestamp>;
  workspaceId: string;
}

export interface GroupUsers {
  createdAt: Generated<Timestamp>;
  groupId: string;
  id: Generated<string>;
  updatedAt: Generated<Timestamp>;
  userId: string;
}

export interface PageTransclusionReferences {
  createdAt: Generated<Timestamp>;
  transclusionId: string;
  referencePageId: string;
  id: Generated<string>;
  sourcePageId: string;
  workspaceId: string;
}

export interface PageTransclusions {
  content: Json;
  createdAt: Generated<Timestamp>;
  transclusionId: string;
  id: Generated<string>;
  pageId: string;
  updatedAt: Generated<Timestamp>;
  workspaceId: string;
}

export interface PageHistory {
  content: Json | null;
  contributorIds: Generated<string[] | null>;
  coverPhoto: string | null;
  createdAt: Generated<Timestamp>;
  icon: string | null;
  id: Generated<string>;
  lastUpdatedById: string | null;
  pageId: string;
  slug: string | null;
  slugId: string | null;
  spaceId: string;
  title: string | null;
  updatedAt: Generated<Timestamp>;
  version: number | null;
  workspaceId: string;
}

export interface Pages {
  content: Json | null;
  contributorIds: Generated<string[] | null>;
  coverAttribution: Json | null;
  coverPhoto: string | null;
  coverPosition: number | null;
  createdAt: Generated<Timestamp>;
  creatorId: string | null;
  deletedAt: Timestamp | null;
  deletedById: string | null;
  icon: string | null;
  id: Generated<string>;
  isBase: Generated<boolean>;
  baseSchemaVersion: Generated<number>;
  isLocked: Generated<boolean>;
  lastUpdatedById: string | null;
  parentPageId: string | null;
  position: string | null;
  slugId: string;
  spaceId: string;
  textContent: string | null;
  title: string | null;
  tsv: string | null;
  updatedAt: Generated<Timestamp>;
  workspaceId: string;
  ydoc: Buffer | null;
}

export interface PublicSpaces {
  createdAt: Generated<Timestamp>;
  creatorId: string | null;
  enabled: Generated<boolean>;
  id: Generated<string>;
  searchIndexing: Generated<boolean>;
  settings: Json | null;
  spaceId: string;
  updatedAt: Generated<Timestamp>;
  workspaceId: string;
}

export interface Shares {
  createdAt: Generated<Timestamp>;
  creatorId: string | null;
  deletedAt: Timestamp | null;
  id: Generated<string>;
  includeSubPages: Generated<boolean | null>;
  key: string;
  pageId: string | null;
  searchIndexing: Generated<boolean | null>;
  spaceId: string;
  updatedAt: Generated<Timestamp>;
  workspaceId: string;
}

export interface SpaceMembers {
  addedById: string | null;
  createdAt: Generated<Timestamp>;
  deletedAt: Timestamp | null;
  groupId: string | null;
  id: Generated<string>;
  role: string;
  spaceId: string;
  updatedAt: Generated<Timestamp>;
  userId: string | null;
}

export interface SiemDestinations {
  config: Json;
  consecutiveFailures: Generated<number>;
  createdAt: Generated<Timestamp>;
  creatorId: string | null;
  cursorCreatedAt: Generated<Timestamp>;
  cursorId: Generated<string>;
  cursorSnapshot: string | null;
  enabled: Generated<boolean>;
  failingSince: Timestamp | null;
  id: Generated<string>;
  lastDeliveredAt: Timestamp | null;
  lastError: string | null;
  lastErrorAt: Timestamp | null;
  name: string;
  nextAttemptAt: Timestamp | null;
  secrets: string;
  status: Generated<string>;
  type: string;
  updatedAt: Generated<Timestamp>;
  version: Generated<number>;
  workspaceId: string;
}

export interface Spaces {
  archivedAt: Timestamp | null;
  archivedById: string | null;
  createdAt: Generated<Timestamp>;
  creatorId: string | null;
  defaultRole: Generated<string>;
  deletedAt: Timestamp | null;
  description: string | null;
  homePageId: string | null;
  id: Generated<string>;
  isPersonal: Generated<boolean>;
  logo: string | null;
  name: string | null;
  settings: Json | null;
  slug: string;
  updatedAt: Generated<Timestamp>;
  visibility: Generated<string>;
  workspaceId: string;
}

export interface UserMfa {
  backupCodes: string[] | null;
  createdAt: Generated<Timestamp>;
  id: Generated<string>;
  isEnabled: Generated<boolean | null>;
  method: Generated<string>;
  secret: string | null;
  updatedAt: Generated<Timestamp>;
  userId: string;
  workspaceId: string;
}

export interface Users {
  avatarUrl: string | null;
  createdAt: Generated<Timestamp>;
  deactivatedAt: Timestamp | null;
  deletedAt: Timestamp | null;
  email: string;
  emailVerifiedAt: Timestamp | null;
  id: Generated<string>;
  invitedById: string | null;
  lastActiveAt: Timestamp | null;
  lastLoginAt: Timestamp | null;
  locale: string | null;
  hasGeneratedPassword: Generated<boolean | null>;
  name: string | null;
  password: string | null;
  role: string | null;
  scimExternalId: string | null;
  settings: Json | null;
  timezone: string | null;
  updatedAt: Generated<Timestamp>;
  workspaceId: string | null;
}

export interface UserTokens {
  createdAt: Generated<Timestamp>;
  expiresAt: Timestamp | null;
  id: Generated<string>;
  token: string;
  type: string;
  usedAt: Timestamp | null;
  userId: string;
  workspaceId: string | null;
}

export interface WorkspaceInvitations {
  createdAt: Generated<Timestamp>;
  email: string | null;
  expiresAt: Timestamp;
  groupIds: string[] | null;
  id: Generated<string>;
  invitedById: string | null;
  message: string | null;
  role: string;
  token: string;
  updatedAt: Generated<Timestamp>;
  workspaceId: string;
}

export interface Workspaces {
  auditRetentionDays: Generated<number>;
  trashRetentionDays: Generated<number>;
  billingEmail: string | null;
  createdAt: Generated<Timestamp>;
  customDomain: string | null;
  defaultRole: Generated<string>;
  defaultSpaceId: string | null;
  deletedAt: Timestamp | null;
  description: string | null;
  emailDomains: Generated<string[] | null>;
  enforceMfa: Generated<boolean | null>;
  enforceSso: Generated<boolean>;
  hostname: string | null;
  isScimEnabled: Generated<boolean>;
  id: Generated<string>;
  licenseKey: string | null;
  logo: string | null;
  name: string | null;
  plan: string | null;
  settings: Json | null;
  status: string | null;
  stripeCustomerId: string | null;
  trialEndAt: Timestamp | null;
  updatedAt: Generated<Timestamp>;
}

export interface Notifications {
  id: Generated<string>;
  userId: string;
  workspaceId: string;
  type: string;
  actorId: string | null;
  pageId: string | null;
  spaceId: string | null;
  commentId: string | null;
  pageVerificationId: string | null;
  data: Json | null;
  readAt: Timestamp | null;
  emailedAt: Timestamp | null;
  archivedAt: Timestamp | null;
  createdAt: Generated<Timestamp>;
}

export interface ScimTokens {
  createdAt: Generated<Timestamp>;
  deletedAt: Timestamp | null;
  id: Generated<string>;
  isEnabled: Generated<boolean>;
  lastUsedAt: Timestamp | null;
  name: string;
  tokenHash: string;
  tokenLastFour: string;
  creatorId: string | null;
  updatedAt: Generated<Timestamp>;
  workspaceId: string;
}

export interface Watchers {
  id: Generated<string>;
  userId: string;
  pageId: string | null;
  spaceId: string;
  workspaceId: string;
  type: string;
  addedById: string | null;
  mutedAt: Timestamp | null;
  createdAt: Generated<Timestamp>;
}

export interface Integrations {
  id: Generated<string>;
  workspaceId: string;
  type: string;
  settings: Json | null;
  installedById: string | null;
  createdAt: Generated<Timestamp>;
  updatedAt: Generated<Timestamp>;
  deletedAt: Timestamp | null;
}

export interface IntegrationConnections {
  id: Generated<string>;
  integrationId: string;
  userId: string;
  workspaceId: string;
  providerUserId: string | null;
  accessToken: string | null;
  refreshToken: string | null;
  tokenExpiresAt: Timestamp | null;
  invalidatedAt: Timestamp | null;
  scopes: string | null;
  kind: string;
  metadata: Json | null;
  createdAt: Generated<Timestamp>;
  updatedAt: Generated<Timestamp>;
}

export interface Labels {
  id: Generated<string>;
  name: string;
  type: Generated<string>;
  workspaceId: string;
  createdAt: Generated<Timestamp>;
  updatedAt: Generated<Timestamp>;
}

export interface PageAccess {
  id: Generated<string>;
  pageId: string;
  workspaceId: string;
  spaceId: string;
  accessLevel: string;
  creatorId: string | null;
  createdAt: Generated<Timestamp>;
  updatedAt: Generated<Timestamp>;
}

export interface PageLabels {
  id: Generated<string>;
  pageId: string;
  labelId: string;
  createdAt: Generated<Timestamp>;
}

export interface PagePermissions {
  id: Generated<string>;
  pageAccessId: string;
  userId: string | null;
  groupId: string | null;
  role: string;
  addedById: string | null;
  createdAt: Generated<Timestamp>;
  updatedAt: Generated<Timestamp>;
}

export interface PageVerifications {
  id: Generated<string>;
  pageId: string;
  workspaceId: string;
  spaceId: string;
  type: Generated<string>;
  status: string | null;
  mode: string | null;
  periodAmount: number | null;
  periodUnit: string | null;
  verifiedAt: Timestamp | null;
  verifiedById: string | null;
  expiresAt: Timestamp | null;
  requestedAt: Timestamp | null;
  requestedById: string | null;
  rejectedAt: Timestamp | null;
  rejectedById: string | null;
  rejectionComment: string | null;
  invalidatedAt: Timestamp | null;
  invalidatedById: string | null;
  verifiedHistoryId: string | null;
  rejectedHistoryId: string | null;
  data: Json | null;
  creatorId: string | null;
  createdAt: Generated<Timestamp>;
  updatedAt: Generated<Timestamp>;
}

export interface PageVerifiers {
  id: Generated<string>;
  pageVerificationId: string;
  userId: string;
  isPrimary: Generated<boolean>;
  addedById: string | null;
  createdAt: Generated<Timestamp>;
}

export interface Templates {
  id: Generated<string>;
  title: string | null;
  description: string | null;
  content: Json | null;
  ydoc: Buffer | null;
  icon: string | null;
  spaceId: string | null;
  workspaceId: string;
  creatorId: string | null;
  lastUpdatedById: string | null;
  collaboratorIds: string[] | null;
  textContent: string | null;
  tsv: string | null;
  createdAt: Generated<Timestamp>;
  updatedAt: Generated<Timestamp>;
  deletedAt: Timestamp | null;
}

export interface AiChats {
  id: Generated<string>;
  workspaceId: string;
  creatorId: string;
  title: string | null;
  createdAt: Generated<Timestamp>;
  updatedAt: Generated<Timestamp>;
  deletedAt: Timestamp | null;
}

export interface AiChatMessages {
  id: Generated<string>;
  chatId: string;
  workspaceId: string;
  userId: string | null;
  role: string;
  content: string | null;
  toolCalls: Json | null;
  metadata: Json | null;
  tsv: string | null;
  createdAt: Generated<Timestamp>;
  updatedAt: Generated<Timestamp>;
  deletedAt: Timestamp | null;
}

export interface UserSessions {
  id: Generated<string>;
  userId: string;
  workspaceId: string;
  deviceName: string | null;
  userAgent: string | null;
  ipAddress: string | null;
  geoLocation: string | null;
  metadata: Json | null;
  lastActiveAt: Generated<Timestamp>;
  expiresAt: Timestamp;
  revokedAt: Timestamp | null;
  createdAt: Generated<Timestamp>;
}

export interface OauthAuthorizationCodes {
  clientId: string;
  codeChallenge: string | null;
  codeChallengeMethod: string | null;
  codeHash: string;
  consumedAt: Timestamp | null;
  createdAt: Generated<Timestamp>;
  expiresAt: Timestamp;
  id: Generated<string>;
  redirectUri: string;
  scopes: Json;
  userId: string;
  workspaceId: string;
}

export interface OauthClients {
  clientUri: string | null;
  createdAt: Generated<Timestamp>;
  deletedAt: Timestamp | null;
  grantTypes: Json;
  id: Generated<string>;
  isDynamic: Generated<boolean>;
  logoUri: string | null;
  name: string;
  redirectUris: Json;
  scopes: Json;
  secretHash: string | null;
  tokenEndpointAuthMethod: Generated<string>;
  updatedAt: Generated<Timestamp>;
  workspaceId: string;
}

export interface OauthGrants {
  clientId: string;
  createdAt: Generated<Timestamp>;
  id: Generated<string>;
  lastUsedAt: Timestamp | null;
  revokedAt: Timestamp | null;
  scopes: Json;
  updatedAt: Generated<Timestamp>;
  userId: string;
  workspaceId: string;
}

export interface OauthTokens {
  accessExpiresAt: Timestamp;
  accessTokenJti: string;
  createdAt: Generated<Timestamp>;
  grantId: string;
  id: Generated<string>;
  refreshExpiresAt: Timestamp | null;
  refreshTokenHash: string | null;
  revokedAt: Timestamp | null;
  scopes: Json;
  workspaceId: string;
}

export interface DB {
  aiChats: AiChats;
  aiChatMessages: AiChatMessages;
  announcements: Announcements;
  apiKeys: ApiKeys;
  attachments: Attachments;
  audit: Audit;
  authAccounts: AuthAccounts;
  authProviders: AuthProviders;
  backlinks: Backlinks;
  basePendingConversions: BasePendingConversions;
  baseProperties: BaseProperties;
  baseRows: BaseRows;
  baseViewShares: BaseViewShares;
  baseViews: BaseViews;
  billing: Billing;
  comments: Comments;
  favorites: Favorites;
  fileTasks: FileTasks;
  groups: Groups;
  groupUsers: GroupUsers;
  integrationConnections: IntegrationConnections;
  integrations: Integrations;
  labels: Labels;
  notifications: Notifications;
  pageAccess: PageAccess;
  pageTransclusionReferences: PageTransclusionReferences;
  pageTransclusions: PageTransclusions;
  pagePermissions: PagePermissions;
  pageHistory: PageHistory;
  pageLabels: PageLabels;
  pageVerifications: PageVerifications;
  pageVerifiers: PageVerifiers;
  pages: Pages;
  publicSpaces: PublicSpaces;
  scimTokens: ScimTokens;
  shares: Shares;
  siemDestinations: SiemDestinations;
  spaceMembers: SpaceMembers;
  spaces: Spaces;
  templates: Templates;
  userMfa: UserMfa;
  users: Users;
  userSessions: UserSessions;
  userTokens: UserTokens;
  watchers: Watchers;
  workspaceInvitations: WorkspaceInvitations;
  workspaces: Workspaces;
  oauthAuthorizationCodes: OauthAuthorizationCodes;
  oauthClients: OauthClients;
  oauthGrants: OauthGrants;
  oauthTokens: OauthTokens;
}
