import { ApiProperty, ApiPropertyOptional } from "@nestjs/swagger"
import { IsNotEmpty, IsNumber, IsOptional } from "class-validator"
import { messageKey } from "src/constants/message-keys"
import { validationMessage } from "src/utils/helpers"

export class CreateAddOnPricingDto {
  @ApiProperty({
    description: "The ID of the pricing plan this vehicle pricing belongs to",
    example: 1,
  })
  @IsNumber()
  @IsNotEmpty({
    message: validationMessage(messageKey.field_required, {
      ":field": "Plan ID",
    }),
  })
  plan_id: number

  @ApiProperty({
    description: "The ID of the vehicle type",
    example: 2,
  })
  @IsNumber()
  @IsOptional()
  vehicle_type_id: number

  @ApiProperty({
    description: "The ID of the add-on",
    example: 3,
  })
  @IsNumber()
  @IsNotEmpty({
    message: validationMessage(messageKey.field_required, {
      ":field": "Add-On ID",
    }),
  })
  add_on_id: number

  @ApiPropertyOptional({
    description: "The ID of the city (optional)",
    example: 10,
  })
  @IsOptional()
  @IsNumber()
  city_id?: number

  @ApiProperty({
    description:
      "The price for this plan, vehicle type, add-on, and (optional) city combination",
    example: 299.99,
  })
  @IsNumber()
  @IsNotEmpty({
    message: validationMessage(messageKey.field_required, {
      ":field": "Price",
    }),
  })
  price: number
}
