import APIUrl from "../helpers/ApiUrl";
import MakeRequest from "../helpers/makeRequest";
import { IACGSearchObj, IACGDetailsReceiveFields } from "../interfaces/Interfaces";

//? This Feature is still under development

export default class ActiveCompositionGroups {
    static async searchACGS(searchParam: IACGSearchObj) {
        const postData = null;
        const acgsList = await MakeRequest.httpRequest(APIUrl.getACGListAPI(), "GET", postData, searchParam);
        return acgsList;
    }

    static async getACGDetails(acgId: string, searchParam: IACGDetailsReceiveFields | null = null) {
        const postData = null;
        let params = {};
        if (searchParam) {
            params = {
                "fields": searchParam?.fields?.join(', ')
            }
        };
        const acgDetails = await MakeRequest.httpRequest(APIUrl.getACGDetailAPI(acgId), "GET", postData, params);
        return acgDetails;
    }

    static async getACGCreatedDeltaList() {
        const list = await MakeRequest.httpRequest(APIUrl.getCreatedACGListAPI(), "GET", null, null);
        return list;
    }

    static async getACGUpdatedDeltaList() {
        const list = await MakeRequest.httpRequest(APIUrl.getUpdatedACGListAPI(), "GET", null, null);
        return list;
    }

    static async getACGDeletedDeltaList() {
        const list = await MakeRequest.httpRequest(APIUrl.getDeletedACGListAPI(), "GET", null, null);
        return list;
    }
}