import type Organization from '#models/organization'
import { BaseTransformer } from '@adonisjs/core/transformers'

export default class OrganizationTransformer extends BaseTransformer<Organization> {
  toObject() {
    const o = this.resource
    return {
      // UUID natif (cf. CLAUDE.md → Conventions techniques).
      id: o.id,
      name: o.name,
      siret: o.siret,
      monthlyVolumeBucket: o.monthlyVolumeBucket,
      rubisCount: o.rubisCount,
      onboardingCompletedAt: o.onboardingCompletedAt?.toISO() ?? null,
      createdAt: o.createdAt.toISO()!,
      updatedAt: o.updatedAt?.toISO() ?? o.createdAt.toISO()!,
    }
  }
}
