import {Num, Uid, Attr, Bool, Str} from 'pinia-orm/dist/decorators'
import { Historical } from '~/types/interfaces'
import Access from "~/models/Access/Access";
import OrganizationProfile from "~/models/Organization/OrganizationProfile";
import ApiResource from "~/models/ApiResource";

/**
 * Ap2i ApiResource : AccessProfile
 *
 * @see https://gitlab.2iopenservice.com/opentalent/ap2i/-/blob/develop/src/ApiResources/Profile/AccessProfile.php
 */
export default class MyProfile extends ApiResource {
  static entity = 'my_profile'

  @Uid()
  declare id: number | string | null

  @Bool(false)
  declare isAdminAccess: boolean

  @Bool(false)
  declare isSuperAdminAccess: boolean

  @Str(null)
  declare name: string

  @Str(null)
  declare givenName: string

  @Str(null)
  declare gender: string

  @Num(null)
  declare avatarId: number

  @Attr([])
  declare roles: Array<string>

  @Num(0, { notNullable: false })
  declare activityYear: number

  @Attr({})
  declare historical: Historical

  @Bool(false)
  declare isGuardian: boolean

  @Bool(false)
  declare isPayor: boolean

  @Attr({})
  declare organization: OrganizationProfile | null

  @Attr([])
  declare multiAccesses: Array<string>

  @Attr([])
  declare familyAccesses: Array<string>

  @Attr({})
  declare originalAccess: Access | null
}
