import { IsString, IsNumber, IsOptional, IsObject } from "class-validator"
import { ApiProperty, ApiPropertyOptional } from "@nestjs/swagger"

export class CreateInvoiceSettingsDto {
  @ApiProperty({
    description: "Notes for the invoice settings",
    example: "Default invoice settings for customer",
  })
  @IsString()
  notes: string

  @ApiPropertyOptional({
    description: "Customer ID associated with these settings",
    example: 1,
  })
  @IsOptional()
  @IsNumber()
  client_id?: number

  @ApiProperty({
    description: "Client tax",
    example: "12",
  })
  @IsOptional()
  @IsString()
  client_tax: string

  @ApiPropertyOptional({
    description: "Fields configuration for the invoice",
    example: {
      invoice_number: {
        visible: true,
        label: "Invoice Number",
        is_fixed: true,
      },
      service_to_prn: { visible: true, label: "PRN", is_fixed: false },
    },
  })
  @IsOptional()
  @IsObject()
  fields?: {
    [key: string]: {
      visible: boolean
      label: string
      is_fixed?: boolean
    }
  }
}
