/**
 * @aurora-catalyst-generated
 * @source cliter/iam/user.aurora.yaml
 */
import { IamAccountFieldSchema } from '@app/iam/account';
import { FieldSchema } from '@aurorajs.dev/core-back';

/**
 * Field schema for IamUser, derived from cliter/iam/user.aurora.yaml.
 * Used by @Sanitize decorator, @Format decorator and @ApplySchema decorator.
 */
export const IamUserFieldSchema: FieldSchema[] = [
  {
    name: 'id',
    type: 'id',
    nullable: false,
    maxLength: 36,
  },
  {
    name: 'accountId',
    type: 'id',
    nullable: false,
    maxLength: 36,
  },
  {
    name: 'account',
    type: 'relation',
    cardinality: 'one',
    target: () => IamAccountFieldSchema,
  },
  {
    name: 'name',
    type: 'varchar',
    nullable: false,
    maxLength: 128,
    rules: { minLength: 1 },
  },
  {
    name: 'surname',
    type: 'varchar',
    nullable: true,
    maxLength: 255,
  },
  {
    name: 'avatar',
    type: 'varchar',
    nullable: true,
    maxLength: 255,
  },
  {
    name: 'mobile',
    type: 'varchar',
    nullable: true,
    maxLength: 64,
  },
  {
    name: 'langId',
    type: 'id',
    nullable: true,
    maxLength: 36,
  },
  {
    name: 'password',
    type: 'password',
    nullable: false,
    maxLength: 255,
  },
  {
    name: 'isTwoFactorAuthenticationEnabled',
    type: 'boolean',
    nullable: false,
  },
  {
    name: 'twoFactorAuthenticationSecret',
    type: 'varchar',
    nullable: true,
    maxLength: 32,
  },
  {
    name: 'rememberToken',
    type: 'varchar',
    nullable: true,
    maxLength: 255,
  },
  {
    name: 'meta',
    type: 'jsonb',
    nullable: true,
  },
  {
    name: 'createdAt',
    type: 'timestamp',
    nullable: true,
  },
  {
    name: 'updatedAt',
    type: 'timestamp',
    nullable: true,
  },
  {
    name: 'deletedAt',
    type: 'timestamp',
    nullable: true,
  },
];
