/**
 * @aurora-catalyst-generated
 * @source cliter/o-auth/refresh-token.aurora.yaml
 */
import { OAuthAccessTokenFieldSchema } from '@app/o-auth/access-token';
import { FieldSchema } from '@aurorajs.dev/core-back';

/**
 * Field schema for OAuthRefreshToken, derived from cliter/o-auth/refresh-token.aurora.yaml.
 * Used by @Sanitize decorator, @Format decorator and @ApplySchema decorator.
 */
export const OAuthRefreshTokenFieldSchema: FieldSchema[] = [
  {
    name: 'id',
    type: 'id',
    nullable: false,
    maxLength: 36,
  },
  {
    name: 'accessTokenId',
    type: 'id',
    nullable: false,
    maxLength: 36,
  },
  {
    name: 'accessToken',
    type: 'relation',
    cardinality: 'one',
    target: () => OAuthAccessTokenFieldSchema,
  },
  {
    name: 'token',
    type: 'text',
    nullable: false,
    rules: { minLength: 1 },
  },
  {
    name: 'isRevoked',
    type: 'boolean',
    nullable: false,
  },
  {
    name: 'expiresAt',
    type: 'timestamp',
    nullable: true,
  },
  {
    name: 'createdAt',
    type: 'timestamp',
    nullable: true,
  },
  {
    name: 'updatedAt',
    type: 'timestamp',
    nullable: true,
  },
  {
    name: 'deletedAt',
    type: 'timestamp',
    nullable: true,
  },
];
