import { ApiProperty, ApiPropertyOptional } from "@nestjs/swagger"; import { Type } from "class-transformer"; import { IsArray, IsEmail, IsEnum, IsMongoId, IsNotEmpty, IsOptional, IsString, ValidateNested, } from "class-validator"; import { RoleEnum } from "src/Types&Enums/role.enum"; import { UserType } from "src/Types&Enums/userType.enum"; export class ExpertLocationDto { @ApiProperty({ example: "210050", description: "Fanavaran Location / OpBUId" }) @IsString() @IsNotEmpty() id: string; @ApiProperty({ example: "شعبه غرب" }) @IsString() @IsNotEmpty() name: string; } export class CreateInsurerExpertDto { @ApiProperty({ example: "Ali" }) @IsString() @IsNotEmpty() firstName: string; @ApiProperty({ example: "Ahmadi" }) @IsString() @IsNotEmpty() lastName: string; @ApiProperty({ example: "1234567890" }) @IsString() @IsNotEmpty() nationalCode: string; @ApiProperty({ example: "expert@example.com" }) @IsEmail() email: string; @ApiProperty({ example: "StrongPass!123" }) @IsString() @IsNotEmpty() password: string; @ApiProperty({ example: "09121234567" }) @IsString() @IsNotEmpty() mobile: string; @ApiProperty({ example: "665f0e5ab74d670939b08920", description: "Branch id this expert belongs to", }) @IsMongoId() branchId: string; @ApiPropertyOptional({ enum: UserType, example: UserType.LEGAL }) @IsOptional() @IsEnum(UserType) userType?: UserType; @ApiPropertyOptional({ example: "02112345678" }) @IsOptional() @IsString() phone?: string; @ApiPropertyOptional({ example: "Tehran" }) @IsOptional() @IsString() state?: string; @ApiPropertyOptional({ example: "Tehran" }) @IsOptional() @IsString() city?: string; @ApiPropertyOptional({ example: "No. 12, Sample St." }) @IsOptional() @IsString() address?: string; } export class CreateBlameExpertByInsurerDto extends CreateInsurerExpertDto { @ApiPropertyOptional({ enum: [RoleEnum.EXPERT], default: RoleEnum.EXPERT, }) role?: RoleEnum.EXPERT; } export class CreateClaimExpertByInsurerDto extends CreateInsurerExpertDto { @ApiPropertyOptional({ enum: [RoleEnum.DAMAGE_EXPERT], default: RoleEnum.DAMAGE_EXPERT, }) role?: RoleEnum.DAMAGE_EXPERT; } export class CreateFileMakerByInsurerDto extends CreateInsurerExpertDto { @ApiPropertyOptional({ enum: [RoleEnum.FILE_MAKER], default: RoleEnum.FILE_MAKER, }) role?: RoleEnum.FILE_MAKER; @ApiPropertyOptional({ type: [ExpertLocationDto], description: "Fanavaran Location entries (id = OpBUId). Used for Parsian V4/V5 submits.", }) @IsOptional() @IsArray() @ValidateNested({ each: true }) @Type(() => ExpertLocationDto) locations?: ExpertLocationDto[]; } export class CreateFileReviewerByInsurerDto extends CreateInsurerExpertDto { @ApiPropertyOptional({ enum: [RoleEnum.FILE_REVIEWER], default: RoleEnum.FILE_REVIEWER, }) role?: RoleEnum.FILE_REVIEWER; @ApiPropertyOptional({ type: [ExpertLocationDto], description: "Fanavaran Location entries. Must overlap FileMaker locations on Parsian V4/V5 cases.", }) @IsOptional() @IsArray() @ValidateNested({ each: true }) @Type(() => ExpertLocationDto) locations?: ExpertLocationDto[]; }