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

export class OAuthAccessTokenDto {
  @ApiProperty({
    type: String,
    description:
      'Unique identifier for the access 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 OAuth client that owns this access token. Links the token to the application and grant type used for authorization.',
    example: '589cf4d0-af83-5c3a-8683-3c162633d000',
  })
  clientId: string;

  @ApiProperty({
    type: () => OAuthClientDto,
    description: 'OAuthClient [input here api field description]',
  })
  client?: OAuthClientDto;

  @ApiProperty({
    type: String,
    description:
      "ID of the account (user) associated with this token. NULL for client_credentials grants that don't represent a specific user. Used to link tokens to user identity.",
  })
  accountId?: string;

  @ApiProperty({
    type: String,
    description:
      'The access token string. JWT or opaque token value. SECURITY: Transmitted in Authorization headers for API authentication. Should be short-lived to minimize security risk.',
  })
  token: string;

  @ApiProperty({
    type: String,
    description:
      'Optional descriptive name for the access token. Useful for personal access tokens or long-lived tokens to identify their purpose (e.g., "Mobile App", "CI/CD Pipeline").',
  })
  name?: string;

  @ApiProperty({
    type: Boolean,
    description:
      'Indicates whether the access token has been revoked. Revoked tokens are rejected for API authentication. Set to true on logout, security events, or manual revocation.',
  })
  isRevoked: boolean;

  @ApiProperty({
    type: String,
    description:
      'Expiration timestamp for the access token. After this time, the token is invalid for API requests. Typically set to minutes or hours from creation for security.',
  })
  expiresAt?: string;

  @ApiProperty({
    type: () => OAuthRefreshTokenDto,
    description:
      'One-to-one relationship with a refresh token. When present, the refresh token can be used to obtain a new access token after this one expires.',
  })
  refreshToken?: OAuthRefreshTokenDto;

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

  @ApiProperty({
    type: String,
    description:
      'Timestamp when the access 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;
}
