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

export class CreateCheckoutDto {
  @ApiProperty({
    description: "Plan ID to subscribe to",
    example: "1",
  })
  @IsNotEmpty({
    message: validationMessage(messageKey.field_required, {
      ":field": "plan_id",
    }),
  })
  @IsString()
  plan_id: string

  @ApiPropertyOptional({
    description: "Success URL for redirect after payment",
    example: "http://localhost:3000/success",
  })
  @IsOptional()
  @IsString()
  success_url?: string

  @ApiPropertyOptional({
    description: "Cancel URL for redirect if payment is cancelled",
    example: "http://localhost:3000/cancel",
  })
  @IsOptional()
  @IsString()
  cancel_url?: string
}
