/**
 * @aurora-catalyst-generated
 * @source cliter/o-auth/application.aurora.yaml
 */
import { OAuthClientFieldSchema } from '@app/o-auth/client';
import { FieldSchema } from '@aurorajs.dev/core-back';

/**
 * Field schema for OAuthApplication, derived from cliter/o-auth/application.aurora.yaml.
 * Used by @Sanitize decorator, @Format decorator and @ApplySchema decorator.
 */
export const OAuthApplicationFieldSchema: FieldSchema[] = [
  {
    name: 'id',
    type: 'id',
    nullable: false,
    maxLength: 36,
  },
  {
    name: 'code',
    type: 'varchar',
    nullable: false,
    maxLength: 64,
    rules: { minLength: 1 },
  },
  {
    name: 'name',
    type: 'varchar',
    nullable: false,
    maxLength: 128,
    rules: { minLength: 1 },
  },
  {
    name: 'secret',
    type: 'varchar',
    nullable: false,
    maxLength: 128,
    rules: { minLength: 1 },
  },
  {
    name: 'isMaster',
    type: 'boolean',
    nullable: false,
  },
  {
    name: 'clients',
    type: 'relation',
    cardinality: 'many',
    target: () => OAuthClientFieldSchema,
  },
  {
    name: 'createdAt',
    type: 'timestamp',
    nullable: true,
  },
  {
    name: 'updatedAt',
    type: 'timestamp',
    nullable: true,
  },
  {
    name: 'deletedAt',
    type: 'timestamp',
    nullable: true,
  },
];
