import {
  IsString,
  IsNotEmpty,
  IsOptional,
  IsDateString,
  MaxLength,
} from 'class-validator';

export class CreateChildDto {
  @IsString()
  @IsNotEmpty({ message: '子女姓名不能为空' })
  @MaxLength(50, { message: '姓名最多50个字符' })
  name: string;

  @IsString()
  @IsOptional()
  gender?: string;

  @IsDateString({}, { message: '出生日期格式不正确' })
  @IsOptional()
  birthday?: string;

  @IsString()
  @IsOptional()
  @MaxLength(20)
  grade?: string;

  @IsString()
  @IsOptional()
  @MaxLength(50)
  city?: string;

  @IsString()
  @IsOptional()
  @MaxLength(100)
  schoolName?: string;
}

export class UpdateChildDto {
  @IsString()
  @IsOptional()
  @MaxLength(50)
  name?: string;

  @IsString()
  @IsOptional()
  gender?: string;

  @IsDateString({}, { message: '出生日期格式不正确' })
  @IsOptional()
  birthday?: string;

  @IsString()
  @IsOptional()
  @MaxLength(20)
  grade?: string;

  @IsString()
  @IsOptional()
  @MaxLength(50)
  city?: string;

  @IsString()
  @IsOptional()
  @MaxLength(100)
  schoolName?: string;
}
