import config from '../utils/config';
export const startRecording = async (options) => {
    const { authToken, organizationId, roomName } = options;
    const response = await fetch(`${config.apiBase}/v1/organizations/${organizationId}/rooms/${roomName}/recording`, {
        method: 'POST',
        headers: {
            Accept: 'application/json',
            'Content-Type': 'application/json',
            Authorization: `Bearer ${authToken}`,
        },
    });
    if (response.status !== 201) {
        throw new Error('Recording failed to start');
    }
    return response.json();
};
export const stopRecording = async (options) => {
    const { authToken, organizationId, roomName, recordingId, } = options;
    const response = await fetch(`${config.apiBase}/v1/organizations/${organizationId}/rooms/${roomName}/recordings/${recordingId}`, {
        method: 'PUT',
        body: JSON.stringify({ recordingAction: 'stop' }),
        headers: {
            Accept: 'application/json',
            'Content-Type': 'application/json',
            Authorization: `Bearer ${authToken}`,
        },
    });
    if (response.status !== 201) {
        throw new Error('Recording failed to stop');
    }
    return response.json();
};
export const getActiveRecording = async (options) => {
    const { authToken, organizationId, roomName, } = options;
    const response = await fetch(`${config.apiBase}/v1/organizations/${organizationId}/rooms/${roomName}/active-recording`, {
        method: 'GET',
        headers: {
            Accept: 'application/json',
            'Content-Type': 'application/json',
            Authorization: `Bearer ${authToken}`,
        },
    });
    return response.json();
};
//# sourceMappingURL=recording.js.map