/**
 * Turns a field's read/write selections into the string the BI `permissions`
 * param expects, e.g. {"Installed apps":"Read and Write","Site visitors":null}.
 */
export const formatPermissionsForBi = (formValues) => {
    const { readApps, readUsers, writeApps, writeUsers } = formValues;
    const apps = [];
    const users = [];
    if (readApps) {
        apps.push('Read');
    }
    if (writeApps) {
        apps.push('Write');
    }
    if (readUsers) {
        users.push('Read');
    }
    if (writeUsers) {
        users.push('Write');
    }
    return JSON.stringify({
        'Installed apps': apps.length !== 0 ? apps.join(' and ') : null,
        'Site visitors': users.length !== 0 ? users.join(' and ') : null,
    });
};
//# sourceMappingURL=formatPermissionsForBi.js.map