import { IsNotEmpty, IsOptional, IsString, IsInt, IsNumber, IsIn, Min, Max, MaxLength } from "class-validator"; export class DispatchPriceQueryDTO { @IsOptional() @IsInt() @Min(1) page?: number = 1; @IsOptional() @IsInt() @Min(1) @Max(200, { message: "分页大小不能超过 200 条" }) pageSize?: number = 10; @IsOptional() @IsString() @MaxLength(64, { message: "关键词最大 64 字符" }) keyword?: string; @IsOptional() @IsString() @MaxLength(32) dispatchType?: string; @IsOptional() @IsIn([1, 2], { message: "计价方式非法" }) priceMode?: number; @IsOptional() @IsIn([0, 1], { message: "状态值非法" }) status?: number; } export class DispatchPriceCreateDTO { @IsNotEmpty({ message: "派单类型不能为空" }) @IsString() @MaxLength(32) dispatchType!: string; @IsNotEmpty({ message: "单价不能为空" }) @IsNumber({}, { message: "单价必须为数字" }) unitPrice!: number; @IsOptional() @IsString() @MaxLength(32) priceType?: string; @IsOptional() @IsIn([1, 2], { message: "计价方式非法" }) priceMode?: number; @IsOptional() @IsString() @MaxLength(16) unit?: string; @IsOptional() @IsIn([0, 1], { message: "状态值非法" }) status?: number; @IsOptional() @IsString() @MaxLength(255) remark?: string; } export class DispatchPriceUpdateDTO { @IsOptional() @IsString() @MaxLength(32) dispatchType?: string; @IsOptional() @IsString() @MaxLength(32) priceType?: string; @IsOptional() @IsIn([1, 2], { message: "计价方式非法" }) priceMode?: number; @IsOptional() @IsNumber({}, { message: "单价必须为数字" }) unitPrice?: number; @IsOptional() @IsString() @MaxLength(16) unit?: string; @IsOptional() @IsIn([0, 1], { message: "状态值非法" }) status?: number; @IsOptional() @IsString() @MaxLength(255) remark?: string; }