export type CustomerType = "INDIVIDUAL" | "COMPANY";
export type CustomerStatus = "ACTIVE" | "INACTIVE" | "DELINQUENT";

export interface CustomerDocument {
  id: string;
  customerId: string;
  name: string;
  fileUrl: string;
  fileType: string;
  createdAt: string;
}

export interface CustomerRentalSummary {
  id: string;
  code: string;
  status: string;
  total: number;
  startDate: string;
  endDate: string;
}

export interface CustomerReceivableSummary {
  id: string;
  description: string;
  amount: number;
  dueDate: string;
  status: string;
}

export interface Customer {
  id: string;
  companyId: string;
  type: CustomerType;
  name: string;
  document: string;
  email?: string | null;
  phone?: string | null;
  mobile?: string | null;
  contactName?: string | null;
  creditLimit: number;
  status: CustomerStatus;
  notes?: string | null;
  zipCode?: string | null;
  street?: string | null;
  number?: string | null;
  complement?: string | null;
  district?: string | null;
  city?: string | null;
  state?: string | null;
  createdAt: string;
  updatedAt: string;
  _count?: {
    rentals: number;
    receivables: number;
    documents: number;
  };
  documents?: CustomerDocument[];
  rentals?: CustomerRentalSummary[];
  receivables?: CustomerReceivableSummary[];
}

export interface CreateCustomerDTO {
  type: CustomerType;
  name: string;
  document: string;
  email?: string;
  phone?: string;
  mobile?: string;
  contactName?: string;
  creditLimit?: number;
  status?: CustomerStatus;
  notes?: string;
  zipCode?: string;
  street?: string;
  number?: string;
  complement?: string;
  district?: string;
  city?: string;
  state?: string;
}

export type UpdateCustomerDTO = Partial<CreateCustomerDTO>;

export interface CustomerStats {
  total: number;
  active: number;
  inactive: number;
  delinquent: number;
  totalCreditLimit: number;
}

export interface CustomerFilterParams {
  search?: string;
  status?: CustomerStatus | "ALL";
  type?: CustomerType | "ALL";
  page?: number;
  limit?: number;
}
