import { typeParser } from '@lib/utils/type-parser';
import { ApiProperty, ApiPropertyOptional } from '@nestjs/swagger';
import { Expose, Transform } from 'class-transformer';
import { IsIn, IsInt, IsOptional, IsString } from 'class-validator';

export class AnalysisBasic {
  @Expose()
  @ApiProperty({ description: '분석기본 id' })
  @Transform(({ value }) => typeParser.int(value))
  @IsInt()
  asbId!: number;

  @Expose()
  @ApiProperty({ description: '진료시작일' })
  @IsString()
  asbTreatStartDate!: string;

  @Expose()
  @ApiProperty({ description: '병/의원&약국' })
  @IsString()
  asbHospitalName!: string;

  @Expose()
  @ApiPropertyOptional({ description: '진단과' })
  @IsString()
  @IsOptional()
  asbDepartment?: string;

  @Expose()
  @ApiProperty({ description: '타입(외래/입원)' })
  @IsString()
  asbTreatType!: string;

  @Expose()
  @ApiPropertyOptional({ description: '주상병코드' })
  @IsString()
  @IsOptional()
  asbDiseaseCode?: string;

  @Expose()
  @ApiPropertyOptional({ description: '주상병명' })
  @IsString()
  @IsOptional()
  asbDiseaseName?: string;

  @Expose()
  @ApiProperty({ description: '내원일수(1:내원 | <1:입원' })
  @IsInt()
  @Transform(({ value }) => typeParser.int(value))
  asbVisitDays!: number;

  @Expose()
  @ApiPropertyOptional({ description: '분석대조한 질병' })
  @IsString()
  @IsOptional()
  asbDisease?: string;

  @Expose()
  @ApiPropertyOptional({ description: '분석대조한 숨은보험질병' })
  @IsString()
  @IsOptional()
  asbInDisease?: string;

  @Expose()
  @ApiPropertyOptional({ description: '분석대조한 주의사항' })
  @IsString()
  @IsOptional()
  asbNotice?: string;

  @Expose()
  @ApiPropertyOptional({ description: '분석대조한 치아고지틀니' })
  @IsString()
  @IsOptional()
  asbDentures?: string;

  @Expose()
  @ApiPropertyOptional({ description: '분석대조한 치아고지1년' })
  @IsString()
  @IsOptional()
  asbToothOne?: string;

  @Expose()
  @ApiPropertyOptional({ description: '분석대조한 치아고지5년' })
  @IsString()
  @IsOptional()
  asbToothFive?: string;

  @Expose()
  @ApiProperty({ description: '매칭된 병원명' })
  @IsString()
  @IsOptional()
  asbEtc?: string;

  @Expose()
  @ApiPropertyOptional({ description: '투약알릴사항' })
  @IsString()
  @IsOptional()
  asbDrugNotice?: string;

  @Expose()
  @ApiProperty({ description: '투약일수' })
  @IsInt()
  @Transform(({ value }) => typeParser.int(value))
  asbDosingDays!: number;

  @Expose()
  @ApiProperty({ description: '투약중복여부' })
  @IsIn([0, 1])
  asbDuplicated!: number;

  @Expose()
  @ApiProperty({ description: '유병자유무(1: 유병자 | 0 : 건강체)' })
  @IsIn([0, 1])
  @Transform(({ value }) => typeParser.int(value))
  asbSicked: number = 0;

  @Expose()
  @ApiPropertyOptional({ description: '분석기본수정일시' })
  @IsString()
  @IsOptional()
  asbUpdaedAt?: string;

  @Expose()
  @ApiProperty({ description: '분석기본생성일시' })
  @IsString()
  asbCreatedAt!: string;
}
