"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.getCpuArchitecture = exports.getDefaultCpuArchitecture = exports.mapClusterCpuArchToInfraEnvCpuArch = exports.mapOcmArchToCpuArchitecture = void 0;
const common_1 = require("../../common");
Object.defineProperty(exports, "getDefaultCpuArchitecture", { enumerable: true, get: function () { return common_1.getDefaultCpuArchitecture; } });
const mapOcmArchToCpuArchitecture = (ocmArch) => {
    switch (ocmArch) {
        case common_1.OcmCpuArchitecture.x86:
            return common_1.CpuArchitecture.x86;
        case common_1.OcmCpuArchitecture.ARM:
            return common_1.CpuArchitecture.ARM;
        case common_1.OcmCpuArchitecture.ppc64le:
            return common_1.CpuArchitecture.ppc64le;
        case common_1.OcmCpuArchitecture.s390x:
            return common_1.CpuArchitecture.s390x;
        case common_1.OcmCpuArchitecture.MULTI:
            return (0, common_1.getDefaultCpuArchitecture)();
        default:
            return undefined;
    }
};
exports.mapOcmArchToCpuArchitecture = mapOcmArchToCpuArchitecture;
/**
 * Takes the cluster.cpuArchitecture value and maps it to
 * a valid infraEnv cpuArchitecture value .
 *
 * @param clusterCpuArchitecture the cluster's cpuArchitecture value
 */
const mapClusterCpuArchToInfraEnvCpuArch = (clusterCpuArchitecture) => {
    switch (clusterCpuArchitecture) {
        case common_1.CpuArchitecture.ARM:
        case common_1.OcmCpuArchitecture.ARM:
            return common_1.CpuArchitecture.ARM;
        case common_1.CpuArchitecture.x86:
        case common_1.OcmCpuArchitecture.x86:
            return common_1.CpuArchitecture.x86;
        case common_1.CpuArchitecture.ppc64le:
        case common_1.OcmCpuArchitecture.ppc64le:
            return common_1.CpuArchitecture.ppc64le;
        case common_1.CpuArchitecture.s390x:
        case common_1.OcmCpuArchitecture.s390x:
            return common_1.CpuArchitecture.s390x;
        case common_1.CpuArchitecture.MULTI:
        case common_1.OcmCpuArchitecture.MULTI:
        default:
            // For multi, use default selection, although they can choose the other architectures too
            return (0, common_1.getDefaultCpuArchitecture)();
    }
};
exports.mapClusterCpuArchToInfraEnvCpuArch = mapClusterCpuArchToInfraEnvCpuArch;
const getCpuArchitecture = (cpuArchitecture) => {
    const cpuArch = mapOcmArchToCpuArchitecture(cpuArchitecture || '');
    return cpuArch || common_1.CpuArchitecture.x86;
};
exports.getCpuArchitecture = getCpuArchitecture;
//# sourceMappingURL=CpuArchitectureService.js.map