import { Transform } from 'class-transformer';
import { IsBoolean, IsDateString, IsInt, IsOptional, IsString, IsUUID, Max, MaxLength, Min } from 'class-validator';

export class UpdateLabCaseImportantDto {
  @IsBoolean()
  isImportant: boolean;
}

export class UpdateLabCaseExternalCodeDto {
  @IsOptional()
  @IsString()
  @MaxLength(64)
  externalCode?: string | null;
}

export class AssignLabCaseTaskDto {
  @IsOptional()
  @IsUUID()
  assigneeUserId?: string | null;
}

export class ListLabCasesDto {
  @IsOptional()
  @IsString()
  q?: string;

  @IsOptional()
  @IsUUID()
  clinicOrganizationId?: string;

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

  @IsOptional()
  @IsDateString()
  sentFrom?: string;

  @IsOptional()
  @IsDateString()
  sentTo?: string;

  @IsOptional()
  @Transform(({ value }) => Number(value))
  @IsInt()
  @Min(1)
  page = 1;

  @IsOptional()
  @Transform(({ value }) => Number(value))
  @IsInt()
  @Min(1)
  @Max(100)
  limit = 20;
}
