import { IsNotEmpty, IsString, IsOptional, IsArray, ValidateNested, ArrayMinSize } from 'class-validator';
import { Type } from 'class-transformer';
import { validationMessages } from '../../../messages/validation-messages';
import { ApiProperty } from '@nestjs/swagger';

export class TranslationDto {

    language_code: string;

    keyword: string;
}

export class CreateDto {
    @ApiProperty({
        example: [
            {
                language_code: 'en',
                keyword: 'English Keyword'
            },
            {
                language_code: 'cn',
                keyword: 'Chinese Keyword'
            }
        ],
        required: true,
        type: [TranslationDto]
    })
    @IsArray()
    @ArrayMinSize(1, { message: validationMessages.keywords.translations_required })
    @ValidateNested({ each: true })
    @Type(() => TranslationDto)
    translations: TranslationDto[];
}

