/**
 * @aurora-catalyst-generated
 * @source cliter/o-auth/refresh-token.aurora.yaml
 */
import { OAuthAccessTokenDto } from '@api/o-auth/access-token';
import { ApiProperty } from '@nestjs/swagger';

export class OAuthRefreshTokenDto {
  @ApiProperty({
    type: String,
    description:
      'Unique identifier for the refresh token. UUID v4 format, generated automatically on creation.',
  })
  id: string;

  @ApiProperty({
    type: Number,
    description:
      'Auto-incrementing row identifier. Used for internal ordering and as a numeric alternative to UUID.',
  })
  rowId: number;

  @ApiProperty({
    type: String,
    description:
      'ID of the associated access token. One-to-one relationship ensures each refresh token is tied to a specific access token instance.',
    example: 'b3e0958b-f617-5cf6-820e-c555fec6dfbf',
  })
  accessTokenId: string;

  @ApiProperty({
    type: () => OAuthAccessTokenDto,
    description:
      'ID of the associated access token. One-to-one relationship ensures each refresh token is tied to a specific access token instance.',
  })
  accessToken?: OAuthAccessTokenDto;

  @ApiProperty({
    type: String,
    description:
      'The refresh token string. JWT or opaque token value. SECURITY: Must be stored securely and treated as a sensitive credential. Used to request new access tokens.',
  })
  token: string;

  @ApiProperty({
    type: Boolean,
    description:
      'Indicates whether the refresh token has been revoked. Revoked tokens cannot be used to obtain new access tokens. Set to true on logout or security events.',
    example: true,
  })
  isRevoked: boolean;

  @ApiProperty({
    type: String,
    description:
      'Expiration timestamp for the refresh token. After this time, the token cannot be used to obtain new access tokens. NULL means no expiration (not recommended for security).',
  })
  expiresAt?: string;

  @ApiProperty({
    type: String,
    description: 'Timestamp when the refresh token was created. Automatically set on creation.',
  })
  createdAt?: string;

  @ApiProperty({
    type: String,
    description:
      'Timestamp when the refresh token was last updated. Automatically updated on modification.',
  })
  updatedAt?: string;

  @ApiProperty({
    type: String,
    description:
      'Soft delete timestamp. NULL means active token. When set, token is excluded from normal queries but preserved for audit trail.',
  })
  deletedAt?: string;
}
