import { ImportBatchSchema } from '#database/schema'
import { belongsTo, hasMany } from '@adonisjs/lucid/orm'
import type { BelongsTo, HasMany } from '@adonisjs/lucid/types/relations'
import Organization from '#models/organization'
import ImportDraft from '#models/import_draft'

export default class ImportBatch extends ImportBatchSchema {
  @belongsTo(() => Organization)
  declare organization: BelongsTo<typeof Organization>

  @hasMany(() => ImportDraft, { foreignKey: 'batchId' })
  declare drafts: HasMany<typeof ImportDraft>
}
