import { ApiVoidResult } from "@core/Models/Api.VoidResult.type";
import {
    DeleteNotificationsByDateParams,
    DeleteSystemNotificationParams,
    FindSystemNotificationsParams,
    PaginateSystemNotificationsParams,
    PaginateSystemNotificationsResults,
    ToggleStateSystemNotificationsParams,
    UnreadNotificationResults,
    UpdateSystemNotificationParams,
} from "@core/Models/SystemNotifications.model";
import ApiRequest from "@services/Api.Service";

export const findSystemNotifications = async (
    data: PaginateSystemNotificationsParams
): Promise<PaginateSystemNotificationsResults> => {
    return ApiRequest.post<PaginateSystemNotificationsResults>("systemnotifications/paginate", data);
};

export const unreadSystemNotifications = async (
    data: FindSystemNotificationsParams
): Promise<UnreadNotificationResults> => {
    return ApiRequest.post<UnreadNotificationResults>("systemnotifications/unread", data);
};

export const deleteSystemNotification = async (
    data: DeleteSystemNotificationParams
): Promise<ApiVoidResult> => {
    return ApiRequest.post<ApiVoidResult>("systemnotifications/delete", data);
};

export const updateSystemNotification = async (
    data: UpdateSystemNotificationParams
): Promise<ApiVoidResult> => {
    return ApiRequest.post<ApiVoidResult>("systemnotifications/update", data);
};

export const setStateNotificationByUser = async (
    data: ToggleStateSystemNotificationsParams
): Promise<ApiVoidResult> => {
    return ApiRequest.post<ApiVoidResult>("systemnotifications/set-state", data);
};

export const deleteNotificationsByDate = async (
    data: DeleteNotificationsByDateParams
): Promise<ApiVoidResult> => {
    return ApiRequest.post<ApiVoidResult>("systemnotifications/delete-by-date", data);
};
