import { BaseApiService } from '@/services/api/base';
import { BaseApiResponse } from '@/types/api/api-general';
import { HppPerKandangReport } from '@/types/api/report/hpp-per-kandang';

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

  async getHppPerKandangReport(
    area_id?: string,
    location_id?: string,
    kandang_id?: string,
    weight_min?: string,
    weight_max?: string,
    period?: string,
    sort_by?: string,
    show_unrecorded?: boolean,
    page?: number,
    limit?: number
  ): Promise<BaseApiResponse<HppPerKandangReport> | undefined> {
    return await this.customRequest<BaseApiResponse<HppPerKandangReport>>(
      `hpp-per-kandang`,
      {
        method: 'GET',
        params: {
          area_id: area_id,
          location_id: location_id,
          kandang_id: kandang_id,
          weight_min: weight_min,
          weight_max: weight_max,
          period: period,
          sort_by: sort_by,
          show_unrecorded: show_unrecorded ?? false,
          page: page,
          limit: limit,
        },
      }
    );
  }
}

export const SaleReportApi = new MarketingSaleReportService('reports');

// export const SaleReportApi = new MarketingSaleReportService(
//   'http://localhost:4010/api/reports/marketings'
// );
