/**
 * @aurora-catalyst-generated
 * @source cliter/iam/bounded-context.aurora.yaml
 */
import { IamPermissionFieldSchema } from '@app/iam/permission';
import { FieldSchema } from '@aurorajs.dev/core-back';

/**
 * Field schema for IamBoundedContext, derived from cliter/iam/bounded-context.aurora.yaml.
 * Used by @Sanitize decorator, @Format decorator and @ApplySchema decorator.
 */
export const IamBoundedContextFieldSchema: FieldSchema[] = [
  {
    name: 'id',
    type: 'id',
    nullable: false,
    maxLength: 36,
  },
  {
    name: 'name',
    type: 'varchar',
    nullable: false,
    maxLength: 128,
    rules: { minLength: 1 },
  },
  {
    name: 'root',
    type: 'varchar',
    nullable: false,
    maxLength: 64,
    rules: { minLength: 1 },
  },
  {
    name: 'sort',
    type: 'smallint',
    nullable: true,
  },
  {
    name: 'isActive',
    type: 'boolean',
    nullable: false,
  },
  {
    name: 'permissions',
    type: 'relation',
    cardinality: 'many',
    target: () => IamPermissionFieldSchema,
  },
  {
    name: 'createdAt',
    type: 'timestamp',
    nullable: true,
  },
  {
    name: 'updatedAt',
    type: 'timestamp',
    nullable: true,
  },
  {
    name: 'deletedAt',
    type: 'timestamp',
    nullable: true,
  },
];
