import { ApiProperty, ApiPropertyOptional } from '@nestjs/swagger';
import { IsObject, IsOptional, IsString, MinLength } from 'class-validator';
import { ESTATE_ID_EXAMPLE, GUARD_ID_EXAMPLE } from '../../common/swagger-docs';

export class CreateIncidentDto {
  @ApiProperty({ example: ESTATE_ID_EXAMPLE, description: 'Estate where the incident occurred.' })
  @IsString()
  estateId!: string;

  @ApiProperty({ example: GUARD_ID_EXAMPLE, description: 'Reporting guard profile ID. Must match guard user for GUARD role.' })
  @IsString()
  guardId!: string;

  @ApiProperty({ example: 'SECURITY', description: 'Incident type or category.' })
  @IsString()
  type!: string;

  @ApiProperty({ example: 'Suspicious activity near the main gate', description: 'Incident details.' })
  @IsString()
  @MinLength(5)
  description!: string;

  @ApiPropertyOptional({ example: { gate: 'Main Gate' }, description: 'Additional incident context.' })
  @IsOptional()
  @IsObject()
  metadata?: Record<string, unknown>;
}
