import { IsInt, IsString } from 'class-validator';
import { ResponseObjectType } from '../enums/ResponseObjectType';
import { IResponse } from './IResponse';

/**
 * Defines the repsonse auth.
*/
export class ResponseAuth implements IResponse {

  /**
    * The responseType.
    * This contains the type of class/entity this response contains.
    */
  responseType: ResponseObjectType = ResponseObjectType.AUTH;

  /**
  * The access_token - JWT shortterm access token.
  */
  @IsString()
  access_token: string;

  /**
  * The refresh_token - longterm refresh token (used for requesting new access tokens).
  */
  @IsString()
  refresh_token: string;

  /**
  * The unix timestamp for access the token's expiry.
  */
  @IsInt()
  access_token_expires_at: number;

  /**
  * The unix unix timestamp for the access token's expiry.
  */
  @IsInt()
  refresh_token_expires_at: number;
}
