"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.checkServiceStatus = checkServiceStatus;
const getPolicyResponseCode_1 = require("./getPolicyResponseCode");
function checkServiceStatus(policy, context, _entity) {
    let checks = [];
    if (policy.services) {
        const services = context.serviceStatus;
        // we need each service to have a status of "online"
        // and if not, return status info
        checks = policy.services.map((service) => {
            let result = "granted";
            if (services[service] !== "online") {
                result = `service-${services[service]}`;
            }
            const check = {
                name: `service ${service} online`,
                value: `service is ${services[service]}`,
                code: (0, getPolicyResponseCode_1.getPolicyResponseCode)(result),
                response: result,
            };
            return check;
        });
    }
    return checks;
}
//# sourceMappingURL=checkServiceStatus.js.map