import { Type } from "class-transformer";
import { IsArray, IsObject, IsOptional, IsString, ValidateNested } from "class-validator";

export class FieldDefinitionDto {
  @IsString()
  key: string;

  @IsObject()
  label: Record<string, string>;

  @IsString()
  unit: string;

  @IsString()
  type: string;
}

export class CreateExerciseCategoryDto {
  @IsObject()
  name: Record<string, string>;

  @IsArray()
  @ValidateNested({ each: true })
  @Type(() => FieldDefinitionDto)
  fields: FieldDefinitionDto[];

  @IsOptional()
  status?: number;
}
