import { BaseApiService } from '@/services/api/base';
import { BaseApiResponse } from '@/types/api/api-general';
import { DebtSupplier } from '@/types/api/report/debt-supplier';

export class DebtSupplierApiService extends BaseApiService<
  DebtSupplier,
  unknown,
  unknown
> {
  constructor(basePath: string) {
    super(basePath);
  }

  async getDebtSupplierReport(
    supplier_ids?: string,
    filter_by?: string,
    start_date?: string,
    end_date?: string
  ): Promise<BaseApiResponse<DebtSupplier[]> | undefined> {
    return await this.customRequest<BaseApiResponse<DebtSupplier[]>>(
      `debt-supplier`,
      {
        method: 'GET',
        params: {
          supplier_ids: supplier_ids,
          filter_by: filter_by,
          start_date: start_date,
          end_date: end_date,
        },
      }
    );
  }
}

export const DebtSupplierApi = new DebtSupplierApiService('reports');
