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

export class TripFilterDto {
  @ApiProperty({
    description: "Customer Name",
    example: "abc",
    required: false,
  })
  @IsOptional()
  search: string

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

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

  @ApiProperty({
    description: "Trip to filter by type",
    example: 5,
    required: false,
  })
  @IsOptional()
  @IsInt()
  trip_type_id?: number

  @ApiProperty({
    description: "Trip to filter by type",
    example: 5,
    required: false,
  })
  @IsOptional()
  @IsInt()
  driver_id?: number

  @ApiProperty({
    description: "Trip status to filter by",
    example: "completed",
    required: false,
  })
  @IsOptional()
  @IsString()
  status?: string

  @ApiProperty({
    description: "Trip customer to filter by",
    example: "1",
    required: false,
  })
  @IsOptional()
  @IsString()
  customer_id?: string

  @ApiProperty({
    description: "Order by field",
    example: "trip.id",
    required: false,
  })
  @IsOptional()
  @IsString()
  order_by?: string

  @ApiProperty({
    description: "Order direction",
    example: "DESC",
    required: false,
  })
  @IsOptional()
  @IsString()
  order?: string

  @ApiProperty({
    description:
      "Filter trips to this date and future (ISO date YYYY-MM-DD). Only trips with pickup_datetime on or after this date are returned.",
    example: "2025-02-13",
    required: false,
  })
  @IsOptional()
  @IsDateString()
  from_date?: string
}
