import APIUrl from "../helpers/ApiUrl";
import MakeRequest from "../helpers/makeRequest";
import { IDAAAllergenSearchObj, IDAASearchObj, IDDAAllergenSearchObj, IDHAAllergenSearchObj, IDIASearchObj } from "../interfaces/Interfaces";

export default class Drugs {
    static async searchDrugIteractions(searchBody: IDIASearchObj) {
        const postData = searchBody;
        const diaList = await MakeRequest.httpRequest(APIUrl.getDrugIterationAlertAPI(), "POST", postData, null);
        return diaList;
    }

    static async searchDrugAllergyAlert(searchParams: IDAASearchObj) {
        const postData = null;
        const params = searchParams;
        const daaList = await MakeRequest.httpRequest(APIUrl.getDrugAllergyAlertAPI(), "GET", postData, params);
        return daaList;
    }

    static async getAllergyClassesList() {
        const postData = null;
        const params = null;
        const allergyClassesList = await MakeRequest.httpRequest(APIUrl.getAllergyClassesListAPI(), "GET", postData, params);
        return allergyClassesList;
    }

    static async searchDrugAllergyAlertsByIngredients(searchBody: IDAAAllergenSearchObj) {
        const postData = searchBody;
        const diaListByIngredient = await MakeRequest.httpRequest(APIUrl.getDrugAllergyAlertByActiveIngredientAPI(), "POST", postData, null);
        return diaListByIngredient;
    }

    static async searchDrugHealthAlert(searchBody: IDHAAllergenSearchObj) {
        const postData = searchBody;
        const dhaList = await MakeRequest.httpRequest(APIUrl.getDrugHealthAlertAPI(), "POST", postData, null);
        return dhaList;
    }

    static async searchDrugDuplicateAlert(searchBody: IDDAAllergenSearchObj) {
        const postData = searchBody;
        const ddaList = await MakeRequest.httpRequest(APIUrl.getDrugDuplicateAlertAPI(), "POST", postData, null);
        return ddaList;
    }

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

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

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