/**
 * Create Invoice DTO
 */

import { InvoiceStatus, InvoiceItemType } from '../entities';

export class CreateInvoiceDto {
  tenantId: string;
  subscriptionId?: string;
  invoiceDate?: Date;
  periodStart: Date;
  periodEnd: Date;
  billingName?: string;
  billingEmail?: string;
  billingAddress?: Record<string, any>;
  taxId?: string;
  dueDate: Date;
  currency?: string;
  notes?: string;
  internalNotes?: string;
  items: CreateInvoiceItemDto[];
}

export class CreateInvoiceItemDto {
  itemType: InvoiceItemType;
  description: string;
  quantity: number;
  unitPrice: number;
  discountPercent?: number;
  metadata?: Record<string, any>;
}

export class UpdateInvoiceDto {
  billingName?: string;
  billingEmail?: string;
  billingAddress?: Record<string, any>;
  taxId?: string;
  dueDate?: Date;
  notes?: string;
  internalNotes?: string;
}

export class RecordPaymentDto {
  amount: number;
  paymentMethod: string;
  paymentReference?: string;
  paymentDate?: Date;
}

export class VoidInvoiceDto {
  reason: string;
}

export class RefundInvoiceDto {
  amount?: number;
  reason: string;
}

export class GenerateInvoiceDto {
  tenantId: string;
  subscriptionId: string;
  periodStart: Date;
  periodEnd: Date;
  includeUsageCharges?: boolean;
}

export class InvoiceFilterDto {
  tenantId?: string;
  status?: InvoiceStatus;
  dateFrom?: Date;
  dateTo?: Date;
  overdue?: boolean;
  limit?: number;
  offset?: number;
}
