/**
 * This file is automatically generated
 * DO NOT EDIT manually
 * Run "node ace migration:run" command to re-generate this file
 */

import { BaseModel, column } from '@adonisjs/lucid/orm'
import { DateTime } from 'luxon'

export class ActivityEventSchema extends BaseModel {
  static $columns = ['at', 'createdAt', 'id', 'kind', 'label', 'meta', 'organizationId', 'updatedAt'] as const
  $columns = ActivityEventSchema.$columns
  @column.dateTime()
  declare at: DateTime
  @column.dateTime({ autoCreate: true })
  declare createdAt: DateTime
  @column({ isPrimary: true })
  declare id: string
  @column()
  declare kind: 'relance_sent' | 'invoice_paid' | 'invoice_imported' | 'warning_drafted'
  @column()
  declare label: string
  @column()
  declare meta: { invoiceId?: string; clientId?: string; planStepOrder?: number; [k: string]: unknown }
  @column()
  declare organizationId: string
  @column.dateTime({ autoCreate: true, autoUpdate: true })
  declare updatedAt: DateTime | null
}

export class AuthAccessTokenSchema extends BaseModel {
  static $columns = ['abilities', 'createdAt', 'expiresAt', 'hash', 'id', 'lastUsedAt', 'name', 'tokenableId', 'type', 'updatedAt'] as const
  $columns = AuthAccessTokenSchema.$columns
  @column()
  declare abilities: string
  @column.dateTime({ autoCreate: true })
  declare createdAt: DateTime | null
  @column.dateTime()
  declare expiresAt: DateTime | null
  @column()
  declare hash: string
  @column({ isPrimary: true })
  declare id: string
  @column.dateTime()
  declare lastUsedAt: DateTime | null
  @column()
  declare name: string | null
  @column()
  declare tokenableId: string
  @column()
  declare type: string
  @column.dateTime({ autoCreate: true, autoUpdate: true })
  declare updatedAt: DateTime | null
}

export class CheckinTaskSchema extends BaseModel {
  static $columns = ['answer', 'answeredAt', 'createdAt', 'id', 'invoiceId', 'organizationId', 'sendAt', 'sentAt', 'status', 'tokenHash', 'updatedAt'] as const
  $columns = CheckinTaskSchema.$columns
  @column()
  declare answer: 'paid' | 'still_pending' | null | null
  @column.dateTime()
  declare answeredAt: DateTime | null
  @column.dateTime({ autoCreate: true })
  declare createdAt: DateTime
  @column({ isPrimary: true })
  declare id: string
  @column()
  declare invoiceId: string
  @column()
  declare organizationId: string
  @column.dateTime()
  declare sendAt: DateTime
  @column.dateTime()
  declare sentAt: DateTime | null
  @column()
  declare status: 'scheduled' | 'sent' | 'answered' | 'expired'
  @column()
  declare tokenHash: string
  @column.dateTime({ autoCreate: true, autoUpdate: true })
  declare updatedAt: DateTime | null
}

export class ClientSchema extends BaseModel {
  static $columns = ['address', 'contactFirstName', 'contactLastName', 'createdAt', 'email', 'id', 'name', 'notes', 'organizationId', 'phone', 'siret', 'updatedAt'] as const
  $columns = ClientSchema.$columns
  @column()
  declare address: string | null
  @column()
  declare contactFirstName: string | null
  @column()
  declare contactLastName: string | null
  @column.dateTime({ autoCreate: true })
  declare createdAt: DateTime
  @column()
  declare email: string
  @column({ isPrimary: true })
  declare id: string
  @column()
  declare name: string
  @column()
  declare notes: string | null
  @column()
  declare organizationId: string
  @column()
  declare phone: string | null
  @column()
  declare siret: string | null
  @column.dateTime({ autoCreate: true, autoUpdate: true })
  declare updatedAt: DateTime | null
}

export class DemoCapturedEmailSchema extends BaseModel {
  static $columns = ['body', 'createdAt', 'fromEmail', 'fromName', 'id', 'kind', 'meta', 'organizationId', 'replyTo', 'sentAt', 'subject', 'toEmail', 'toName', 'updatedAt'] as const
  $columns = DemoCapturedEmailSchema.$columns
  @column()
  declare body: string
  @column.dateTime({ autoCreate: true })
  declare createdAt: DateTime
  @column()
  declare fromEmail: string
  @column()
  declare fromName: string | null
  @column({ isPrimary: true })
  declare id: string
  @column()
  declare kind: string
  @column()
  declare meta: any
  @column()
  declare organizationId: string
  @column()
  declare replyTo: string | null
  @column.dateTime()
  declare sentAt: DateTime
  @column()
  declare subject: string
  @column()
  declare toEmail: string
  @column()
  declare toName: string | null
  @column.dateTime({ autoCreate: true, autoUpdate: true })
  declare updatedAt: DateTime | null
}

export class ImportBatchSchema extends BaseModel {
  static $columns = ['createdAt', 'id', 'organizationId', 'updatedAt'] as const
  $columns = ImportBatchSchema.$columns
  @column.dateTime({ autoCreate: true })
  declare createdAt: DateTime
  @column({ isPrimary: true })
  declare id: string
  @column()
  declare organizationId: string
  @column.dateTime({ autoCreate: true, autoUpdate: true })
  declare updatedAt: DateTime | null
}

export class ImportDraftSchema extends BaseModel {
  static $columns = ['batchId', 'confidence', 'createdAt', 'edited', 'extracted', 'filename', 'id', 'invoiceId', 'pdfStorageKey', 'status', 'updatedAt'] as const
  $columns = ImportDraftSchema.$columns
  @column()
  declare batchId: string
  @column()
  declare confidence: Partial<{ clientId: number; clientName: number; clientEmail: number; numero: number; amountTtcCents: number; issueDate: number; dueDate: number; planId: number }>
  @column.dateTime({ autoCreate: true })
  declare createdAt: DateTime
  @column()
  declare edited: { clientId: string | null; clientName: string; clientEmail: string | null; numero: string; amountTtcCents: number; issueDate: string; dueDate: string; planId: string | null }
  @column()
  declare extracted: { clientId: string | null; clientName: string; clientEmail: string | null; numero: string; amountTtcCents: number; issueDate: string; dueDate: string; planId: string | null }
  @column()
  declare filename: string
  @column({ isPrimary: true })
  declare id: string
  @column()
  declare invoiceId: string | null
  @column()
  declare pdfStorageKey: string | null
  @column()
  declare status: 'pending' | 'validated' | 'skipped'
  @column.dateTime({ autoCreate: true, autoUpdate: true })
  declare updatedAt: DateTime | null
}

export class InvoiceSchema extends BaseModel {
  static $columns = ['amountTtcCents', 'clientId', 'createdAt', 'dueDate', 'id', 'issueDate', 'notes', 'numero', 'organizationId', 'paidAt', 'pdfStorageKey', 'planId', 'rubisEarned', 'status', 'updatedAt'] as const
  $columns = InvoiceSchema.$columns
  @column()
  declare amountTtcCents: number
  @column()
  declare clientId: string
  @column.dateTime({ autoCreate: true })
  declare createdAt: DateTime
  @column.dateTime()
  declare dueDate: DateTime
  @column({ isPrimary: true })
  declare id: string
  @column.dateTime()
  declare issueDate: DateTime
  @column()
  declare notes: string | null
  @column()
  declare numero: string
  @column()
  declare organizationId: string
  @column.dateTime()
  declare paidAt: DateTime | null
  @column()
  declare pdfStorageKey: string | null
  @column()
  declare planId: string | null
  @column()
  declare rubisEarned: number
  @column()
  declare status: 'pending' | 'awaiting_user_confirmation' | 'in_relance' | 'paid' | 'litigation' | 'cancelled'
  @column.dateTime({ autoCreate: true, autoUpdate: true })
  declare updatedAt: DateTime | null
}

export class OrganizationSchema extends BaseModel {
  static $columns = ['billingCycle', 'cancelAtPeriodEnd', 'createdAt', 'currentPeriodEnd', 'demoMode', 'demoSpeedFactor', 'gracePeriodEndsAt', 'id', 'monthlyVolumeBucket', 'name', 'onboardingCompletedAt', 'plan', 'rubisCount', 'siret', 'stripeCustomerId', 'stripeSubscriptionId', 'subscriptionStatus', 'updatedAt', 'virtualNow'] as const
  $columns = OrganizationSchema.$columns
  @column()
  declare billingCycle: string | null
  @column()
  declare cancelAtPeriodEnd: boolean
  @column.dateTime({ autoCreate: true })
  declare createdAt: DateTime
  @column.dateTime()
  declare currentPeriodEnd: DateTime | null
  @column()
  declare demoMode: boolean
  @column()
  declare demoSpeedFactor: number
  @column.dateTime()
  declare gracePeriodEndsAt: DateTime | null
  @column({ isPrimary: true })
  declare id: string
  @column()
  declare monthlyVolumeBucket: string | null
  @column()
  declare name: string
  @column.dateTime()
  declare onboardingCompletedAt: DateTime | null
  @column()
  declare plan: string
  @column()
  declare rubisCount: number
  @column()
  declare siret: string | null
  @column()
  declare stripeCustomerId: string | null
  @column()
  declare stripeSubscriptionId: string | null
  @column()
  declare subscriptionStatus: string | null
  @column.dateTime({ autoCreate: true, autoUpdate: true })
  declare updatedAt: DateTime | null
  @column.dateTime()
  declare virtualNow: DateTime | null
}

export class PlanStepSchema extends BaseModel {
  static $columns = ['body', 'createdAt', 'id', 'offsetDays', 'order', 'planId', 'requiresManualValidation', 'subject', 'tone', 'updatedAt'] as const
  $columns = PlanStepSchema.$columns
  @column()
  declare body: string
  @column.dateTime({ autoCreate: true })
  declare createdAt: DateTime
  @column({ isPrimary: true })
  declare id: string
  @column()
  declare offsetDays: number
  @column()
  declare order: number
  @column()
  declare planId: string
  @column()
  declare requiresManualValidation: boolean
  @column()
  declare subject: string
  @column()
  declare tone: 'amical' | 'courtois' | 'ferme' | 'mise_en_demeure'
  @column.dateTime({ autoCreate: true, autoUpdate: true })
  declare updatedAt: DateTime | null
}

export class PlanSchema extends BaseModel {
  static $columns = ['createdAt', 'description', 'id', 'isDefault', 'name', 'organizationId', 'slug', 'updatedAt'] as const
  $columns = PlanSchema.$columns
  @column.dateTime({ autoCreate: true })
  declare createdAt: DateTime
  @column()
  declare description: string
  @column({ isPrimary: true })
  declare id: string
  @column()
  declare isDefault: boolean
  @column()
  declare name: string
  @column()
  declare organizationId: string
  @column()
  declare slug: string | null
  @column.dateTime({ autoCreate: true, autoUpdate: true })
  declare updatedAt: DateTime | null
}

export class RefreshTokenSchema extends BaseModel {
  static $columns = ['createdAt', 'expiresAt', 'hashedToken', 'id', 'ipAddress', 'lastUsedAt', 'revokedAt', 'updatedAt', 'userAgent', 'userId'] as const
  $columns = RefreshTokenSchema.$columns
  @column.dateTime({ autoCreate: true })
  declare createdAt: DateTime
  @column.dateTime()
  declare expiresAt: DateTime
  @column()
  declare hashedToken: string
  @column({ isPrimary: true })
  declare id: string
  @column()
  declare ipAddress: string | null
  @column.dateTime()
  declare lastUsedAt: DateTime | null
  @column.dateTime()
  declare revokedAt: DateTime | null
  @column.dateTime({ autoCreate: true, autoUpdate: true })
  declare updatedAt: DateTime | null
  @column()
  declare userAgent: string | null
  @column()
  declare userId: string
}

export class RelanceTaskSchema extends BaseModel {
  static $columns = ['createdAt', 'id', 'invoiceId', 'organizationId', 'planStepId', 'queueJobId', 'sendAt', 'sentAt', 'status', 'updatedAt'] as const
  $columns = RelanceTaskSchema.$columns
  @column.dateTime({ autoCreate: true })
  declare createdAt: DateTime
  @column({ isPrimary: true })
  declare id: string
  @column()
  declare invoiceId: string
  @column()
  declare organizationId: string
  @column()
  declare planStepId: string
  @column()
  declare queueJobId: string | null
  @column.dateTime()
  declare sendAt: DateTime
  @column.dateTime()
  declare sentAt: DateTime | null
  @column()
  declare status: 'scheduled' | 'sent' | 'cancelled' | 'failed'
  @column.dateTime({ autoCreate: true, autoUpdate: true })
  declare updatedAt: DateTime | null
}

export class UserSchema extends BaseModel {
  static $columns = ['createdAt', 'email', 'fullName', 'googleId', 'id', 'microsoftId', 'organizationId', 'password', 'signature', 'updatedAt'] as const
  $columns = UserSchema.$columns
  @column.dateTime({ autoCreate: true })
  declare createdAt: DateTime
  @column()
  declare email: string
  @column()
  declare fullName: string | null
  @column()
  declare googleId: string | null
  @column({ isPrimary: true })
  declare id: string
  @column()
  declare microsoftId: string | null
  @column()
  declare organizationId: string | null
  @column({ serializeAs: null })
  declare password: string | null
  @column()
  declare signature: string | null
  @column.dateTime({ autoCreate: true, autoUpdate: true })
  declare updatedAt: DateTime | null
}
