forked from Yara724/api
76 lines
1.8 KiB
TypeScript
76 lines
1.8 KiB
TypeScript
import { ApiProperty, ApiPropertyOptional } from "@nestjs/swagger";
|
|
import { Type } from "class-transformer";
|
|
import {
|
|
IsArray,
|
|
IsEnum,
|
|
IsOptional,
|
|
IsString,
|
|
ValidateNested,
|
|
} from "class-validator";
|
|
import { FactorStatus } from "src/Types&Enums/claim-request-management/factor-status.enum";
|
|
|
|
class FactorDecisionDto {
|
|
@ApiProperty()
|
|
@IsString()
|
|
partId: string;
|
|
|
|
@ApiProperty({ enum: [FactorStatus.APPROVED, FactorStatus.REJECTED] })
|
|
@IsEnum([FactorStatus.APPROVED, FactorStatus.REJECTED])
|
|
status: FactorStatus;
|
|
|
|
@ApiProperty({ required: false })
|
|
@IsOptional()
|
|
@IsString()
|
|
rejectionReason?: string;
|
|
}
|
|
|
|
export class FactorValidationDto {
|
|
@ApiProperty({ type: [FactorDecisionDto] })
|
|
@IsArray()
|
|
@ValidateNested({ each: true })
|
|
@Type(() => FactorDecisionDto)
|
|
decisions: FactorDecisionDto[];
|
|
}
|
|
|
|
/** V2 ClaimCase: expert confirms or overrides part pricing when validating uploaded factors. */
|
|
class FactorDecisionV2Dto {
|
|
@ApiProperty()
|
|
@IsString()
|
|
partId: string;
|
|
|
|
@ApiProperty({ enum: [FactorStatus.APPROVED, FactorStatus.REJECTED] })
|
|
@IsEnum([FactorStatus.APPROVED, FactorStatus.REJECTED])
|
|
status: FactorStatus;
|
|
|
|
@ApiPropertyOptional()
|
|
@IsOptional()
|
|
@IsString()
|
|
rejectionReason?: string;
|
|
|
|
@ApiPropertyOptional({
|
|
description:
|
|
"Expert-adjusted values (Persian/ASCII digits ok). For REJECTED factors, provide at least totalPayment (or price and salary).",
|
|
})
|
|
@IsOptional()
|
|
@IsString()
|
|
price?: string;
|
|
|
|
@ApiPropertyOptional()
|
|
@IsOptional()
|
|
@IsString()
|
|
salary?: string;
|
|
|
|
@ApiPropertyOptional()
|
|
@IsOptional()
|
|
@IsString()
|
|
totalPayment?: string;
|
|
}
|
|
|
|
export class FactorValidationV2Dto {
|
|
@ApiProperty({ type: [FactorDecisionV2Dto] })
|
|
@IsArray()
|
|
@ValidateNested({ each: true })
|
|
@Type(() => FactorDecisionV2Dto)
|
|
decisions: FactorDecisionV2Dto[];
|
|
}
|