import { IsIn, IsInt, IsNotEmpty, IsOptional } from "class-validator"
import { ApiProperty } from "@nestjs/swagger"

export class HospitalContactFilterDto {
  @ApiProperty({
    description: "Hospital ID",
    example: "1",
  })
  @IsNotEmpty({
    message: "Hospital ID is required",
  })
  @IsInt()
  hospital_id: number

  @ApiProperty({
    description: "Limit",
    example: "10",
  })
  @IsInt()
  limit: number

  @ApiProperty({
    description: "Skip",
    example: "0",
  })
  @IsInt()
  skip: number

  @ApiProperty({
    required: false,
    description: "Search by name, email, phone_number, position, department",
    example: "john",
  })
  @IsOptional()
  search?: string

  @ApiProperty({
    required: false,
    description: "Sort by column",
    enum: [
      "created_at",
      "updated_at",
      "name",
      "email",
      "phone_number",
      "position",
      "department",
      "is_primary",
    ],
    example: "created_at",
  })
  @IsOptional()
  sortBy?:
    | "created_at"
    | "updated_at"
    | "name"
    | "email"
    | "phone_number"
    | "position"
    | "department"
    | "is_primary"

  @ApiProperty({
    required: false,
    description: "Sort order",
    enum: ["ASC", "DESC"],
    example: "DESC",
  })
  @IsOptional()
  @IsIn(["ASC", "DESC"])
  sortOrder?: "ASC" | "DESC"
}
