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

export class CreateClientCompanyContractDto {
  @ApiProperty({ example: "2025-09-01" })
  @IsDateString()
  @IsNotEmpty({
    message: validationMessage(messageKey.field_required, {
      ":field": "start_date",
    }),
  })
  start_date: string

  @ApiProperty({ example: "2026-09-01" })
  @IsDateString()
  @IsNotEmpty({
    message: validationMessage(messageKey.field_required, {
      ":field": "end_date",
    }),
  })
  end_date: string

  @ApiProperty({ example: 1 })
  @IsInt()
  @IsNotEmpty({
    message: validationMessage(messageKey.field_required, {
      ":field": "payment_plan_id",
    }),
  })
  payment_plan_id: number

  @ApiProperty({ example: 5 })
  @IsInt()
  @IsOptional()
  authorized_contact_id: number

  @ApiProperty({ example: 5 })
  @IsInt()
  @IsNotEmpty({
    message: validationMessage(messageKey.field_required, {
      ":field": "client_company_id",
    }),
  })
  client_company_id: number

  @ApiPropertyOptional({
    example: "This contract covers transportation services for one year.",
  })
  @IsString()
  @IsOptional()
  description?: string

  @ApiProperty({
    example: "monthly",
    enum: ["monthly", "quarterly", "annually"],
    required: false,
  })
  @IsString()
  @IsOptional()
  payment_schedule: string

  @ApiPropertyOptional({
    example: "contract_document.pdf",
    format: "binary",
  })
  @IsString()
  @IsOptional()
  contract_document?: string

  @ApiPropertyOptional({
    example: "All services must be paid within 30 days of invoicing.",
  })
  @IsString()
  @IsOptional()
  terms_and_conditions?: string

  // @ApiPropertyOptional({
  //   example: "active",
  //   description: "Status of the contract",
  //   enum: ["active", "expired", "upcoming"],
  //   default: "active",
  // })
  @IsString()
  @IsOptional()
  status?: string
}
