import type { DonnaCandidate, DonnaClientDetail, DonnaSettings, DonnaUsageMonth, UpdateDonnaClientPayload } from "@/domain/entities/donna";

export interface DonnaRepository {
  getUsage(params: { month?: string; search?: string }): Promise<DonnaUsageMonth>;
  findClient(companyId: number, month?: string): Promise<DonnaClientDetail>;
  /** Temporary: the price per vehicle typed by hand until the pricing module gives it. */
  updateClient(companyId: number, payload: UpdateDonnaClientPayload): Promise<DonnaClientDetail>;
  /** Grants this month's gift now (for a client priced after the 1st). */
  grantGift(companyId: number): Promise<DonnaClientDetail>;
  /** A gift of a typed amount for this month: a one-off, or the computed gift corrected. */
  customGift(companyId: number, payload: { amount_eur: number; note?: string | null }): Promise<DonnaClientDetail>;
  /** This month's gift for every priced client that does not have it yet. */
  grantAll(): Promise<{ granted: number; amount_eur: number }>;
  /** The companies not on the list yet. */
  getCandidates(search?: string): Promise<DonnaCandidate[]>;
  /** Puts a company on the list, with a gift of the amount typed (or the computed one without it). */
  addClient(payload: { company_id: number; amount_eur?: number | null; note?: string | null }): Promise<DonnaClientDetail>;
  /** Takes a company off the list and takes back this month's gift. */
  removeClient(companyId: number): Promise<void>;
  getSettings(): Promise<DonnaSettings>;
  updateSettings(payload: Partial<DonnaSettings>): Promise<DonnaSettings>;
  revokeGift(grantId: number): Promise<DonnaClientDetail>;
  restoreGift(grantId: number): Promise<DonnaClientDetail>;
}
