import type User from '#models/user'
import { BaseTransformer } from '@adonisjs/core/transformers'

export default class UserTransformer extends BaseTransformer<User> {
  toObject() {
    const u = this.resource
    return {
      // id et organizationId sont des UUID (cf. CLAUDE.md → Conventions techniques).
      id: u.id,
      email: u.email,
      fullName: u.fullName,
      organizationId: u.organizationId,
      signature: u.signature,
      initials: u.initials,
      createdAt: u.createdAt.toISO()!,
      updatedAt: u.updatedAt?.toISO() ?? u.createdAt.toISO()!,
    }
  }
}
