import { ApiPropertyOptional } from "@nestjs/swagger"
import { IsOptional, IsString, IsNumber, IsEnum } from "class-validator"
import { Transform } from "class-transformer"
import { DateRangeType } from "./project-report-filters.dto"
import { ClockInStatusType } from "./clock-in-report-filters.dto"

export class ClockInReportExportDto {
  @ApiPropertyOptional({ description: "Company ID" })
  @IsOptional()
  @Transform(({ value }) => parseInt(value))
  @IsNumber()
  company_id?: number

  @ApiPropertyOptional({ description: "Employee ID" })
  @IsOptional()
  @Transform(({ value }) => parseInt(value))
  @IsNumber()
  employee_id?: number

  @ApiPropertyOptional({ description: "Department ID" })
  @IsOptional()
  @Transform(({ value }) => parseInt(value))
  @IsNumber()
  department_id?: number

  @ApiPropertyOptional({
    description: "Date range type",
    enum: DateRangeType,
    default: DateRangeType.TODAY,
  })
  @IsOptional()
  @IsEnum(DateRangeType)
  date_range?: DateRangeType

  @ApiPropertyOptional({
    description: "Custom start date (DD-MM-YYYY format)",
    example: "01-01-2024",
  })
  @IsOptional()
  @IsString()
  start_date?: string

  @ApiPropertyOptional({
    description: "Custom end date (DD-MM-YYYY format)",
    example: "31-12-2024",
  })
  @IsOptional()
  @IsString()
  end_date?: string

  @ApiPropertyOptional({ description: "Search term" })
  @IsOptional()
  @IsString()
  search?: string

  @ApiPropertyOptional({
    description: "Clock-in status filter",
    enum: ClockInStatusType,
    default: ClockInStatusType.ALL,
  })
  @IsOptional()
  @IsEnum(ClockInStatusType)
  status?: ClockInStatusType

  @ApiPropertyOptional({
    description: "All employee clock in report",
    example: true,
  })
  @IsOptional()
  @IsString()
  show_all?: string
}
