import { ApiProperty, ApiPropertyOptional } from '@nestjs/swagger';
import { IsBoolean, IsEnum, IsNumber, IsOptional, IsString, IsUUID } from 'class-validator';

import {
  INSPECTION_REPORT_TYPES,
  INSPECTION_STATUSES,
  InspectionReportType,
  InspectionStatus,
} from '../entities/warehouse-inspection-report.entity';

export class CreateInspectionReportDto {
  @ApiProperty({ enum: INSPECTION_REPORT_TYPES })
  @IsEnum(INSPECTION_REPORT_TYPES)
  reportType!: InspectionReportType;

  @ApiProperty({ enum: INSPECTION_STATUSES })
  @IsEnum(INSPECTION_STATUSES)
  inspectionStatus!: InspectionStatus;

  @ApiPropertyOptional()
  @IsOptional()
  @IsBoolean()
  hasDamage?: boolean;

  @ApiPropertyOptional()
  @IsOptional()
  @IsString()
  damageDescription?: string;

  @ApiPropertyOptional()
  @IsOptional()
  @IsBoolean()
  hasWeightLoss?: boolean;

  @ApiPropertyOptional()
  @IsOptional()
  @IsNumber()
  expectedWeight?: number;

  @ApiPropertyOptional()
  @IsOptional()
  @IsNumber()
  actualWeight?: number;

  @ApiPropertyOptional()
  @IsOptional()
  @IsBoolean()
  hasMissingItems?: boolean;

  @ApiPropertyOptional()
  @IsOptional()
  @IsString()
  missingItemsDescription?: string;

  @ApiPropertyOptional()
  @IsOptional()
  @IsString()
  remarks?: string;

  @ApiPropertyOptional({ format: 'uuid' })
  @IsOptional()
  @IsUUID()
  inspectedById?: string;
}
