import { ApiProperty } from '@nestjs/swagger';
import { IsIn, IsInt, IsNotEmpty, IsString } from 'class-validator';

export class TokenRequest {
  @ApiProperty()
  @IsString()
  @IsNotEmpty()
  idToken: string;
  @ApiProperty({ description: 'web or mobile or desktop' })
  @IsIn(['web', 'mobile', 'desktop'], { message: 'invalid type' })
  @IsNotEmpty()
  type: string;
}
export class TokenResponse {
  @ApiProperty()
  refreshToken: string;
  @ApiProperty()
  accessToken: string;
}
export class AccessTokenResponse {
  @ApiProperty()
  accessToken: string;
}
export class AccessTokenRequest {}

export type TermsCheckInfo = {
  tier: number;
  acceptedEulaVersion?: string;
  acceptedPrivacyNoticeVersion?: string;
  acceptedDpaVersion?: string;
  latestEulaVersion: string;
  latestPrivacyNoticeVersion: string;
  latestDpaVersion: string;
};

export class DelegationTokenRequest {
  @ApiProperty({ description: '代行操作対象のアカウントID' })
  @IsInt()
  delegatedAccountId: number;
}
export class DelegationTokenResponse {
  @ApiProperty({ description: '代行操作用のリフレッシュトークン' })
  refreshToken: string;
  @ApiProperty({ description: '代行操作用のアクセストークン' })
  accessToken: string;
}

export class DelegationAccessTokenResponse {
  @ApiProperty({ description: '代行操作用のアクセストークン' })
  accessToken: string;
}
