/*
 * Copyright (c) 2022.
 * Author Peter Placzek (tada5hi)
 * For the full copyright and license information,
 * view the LICENSE file that was distributed with this source code.
 */

import {useApi} from "~/modules/api";
import {formatRequestRecord, RequestRecord} from "~/modules/api/utils";

export async function getContactRoom(roomId: number) {
    const response = await useApi('auth')
        .get('/chat/contact-rooms/' + roomId);

    return response.data;
}

export async function getContactRooms(record?: RequestRecord) {
    const {data: response} = await useApi('auth')
        .get('/chat/contact-rooms' + formatRequestRecord(record));

    return response;
}

export async function addContactRoom(data: Record<string, any>) {
    const {data: response} = await useApi('auth')
        .post('/chat/contact-rooms', data);

    return response;
}
