import { createEntityHook } from './useEntityBase';
import i18n from "@/lib/i18n";

export type FeeRuleDTO = {
  id: string;
  code: string;
  name_ar: string;
  name_en: string | null;
  applies_to: string;
  calculation_type: string;
  currency_id: string | null;
  fixed_amount: number;
  percent_value: number;
  min_amount: number;
  max_amount: number | null;
  is_active: boolean;
  starts_at: string | null;
  ends_at: string | null;
  created_at: string;
};

export type TaxRuleDTO = {
  id: string;
  code: string;
  name_ar: string;
  tax_type: string;
  percent_value: number;
  is_active: boolean;
  starts_at: string | null;
  ends_at: string | null;
  created_at: string;
};

export const useFeeRules = createEntityHook<FeeRuleDTO, never, never>(
  i18n.t('hooks.useFees.text_1'),
  '/fees-taxes/fee-rules',
);

export const useTaxRules = createEntityHook<TaxRuleDTO, never, never>(
  i18n.t('hooks.useFees.text_2'),
  '/fees-taxes/tax-rules',
);
