import axios from "axios";
import { getSysAdminNonce } from "../helpers/GetSysAdminNonce";
import { getPayload } from "../helpers/GetPayload";
import { getApiHost } from "../helpers/GetApiHost";
import {
    PaginateServicesParams,
    PaginateServicesResults,
    SetServiceBannedParams,
} from "../models/Services.Model";

export const paginateServices = async (params: PaginateServicesParams): Promise<PaginateServicesResults> => {
    const nonce = await getSysAdminNonce();
    const result = await axios.post(`${getApiHost()}/sysadmin/services/paginate`, {
        ...params,
        payload: getPayload(nonce),
    });
    return result.data;
};

export const setServiceBanned = async (params: SetServiceBannedParams): Promise<any> => {
    const nonce = await getSysAdminNonce();
    const result = await axios.post(`${getApiHost()}/sysadmin/services/set-banned`, {
        ...params,
        payload: getPayload(nonce),
    });
    return result.data;
};
