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

export class CreateGuardDto {
  @ApiProperty({ example: ESTATE_ID_EXAMPLE, description: 'Estate that owns this guard.' })
  @IsString()
  estateId!: string;

  @ApiProperty({ example: 'Ade Okafor', description: 'Guard display name.' })
  @IsOptional()
  @IsString()
  @MinLength(2)
  name?: string;

  @ApiProperty({ example: '+2348000000200', description: 'Unique phone number for guard login.' })
  @IsPhoneNumber()
  phone!: string;

  @ApiPropertyOptional({ example: 'guard-device-002', description: 'Optional physical device or terminal assignment.' })
  @IsOptional()
  @IsString()
  deviceId?: string;

  @ApiPropertyOptional({ example: 'Musa', description: 'Optional first name.' })
  @IsOptional()
  @IsString()
  firstName?: string;

  @ApiPropertyOptional({ example: 'Bello', description: 'Optional last name.' })
  @IsOptional()
  @IsString()
  lastName?: string;

  @ApiPropertyOptional({ example: '12 Unity Road', description: 'Optional guard address.' })
  @IsOptional()
  @IsString()
  address?: string;

  @ApiPropertyOptional({ example: 'gate-uuid', description: 'Gate assigned by estate admin or supervisor.' })
  @IsOptional()
  @IsString()
  assignedGateId?: string;
}
