import { ApiProperty } from '@nestjs/swagger';
import { IsIn, IsString } from 'class-validator';
import { ErrorCode } from '../../../common/errors';

export const SUPPORTED_USER_LANGUAGES = ['en', 'fa', 'nl'] as const;
export type SupportedUserLanguage = (typeof SUPPORTED_USER_LANGUAGES)[number];

export class UpdateLanguageDto {
  @ApiProperty({ enum: SUPPORTED_USER_LANGUAGES, example: 'en' })
  @IsString()
  @IsIn(SUPPORTED_USER_LANGUAGES, {
    message: ErrorCode.VALIDATION_LANGUAGE_INVALID,
  })
  language: SupportedUserLanguage;
}
