"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.getDisabledReasonForCpuArch = exports.getDefaultCpuArchitecture = exports.getSupportedCpuArchitectures = exports.architectureData = exports.getAllCpuArchitectures = exports.featureIdToCpuArchitecture = exports.OcmCpuArchitecture = exports.CpuArchitecture = void 0;
var CpuArchitecture;
(function (CpuArchitecture) {
    CpuArchitecture["x86"] = "x86_64";
    CpuArchitecture["ARM"] = "arm64";
    CpuArchitecture["MULTI"] = "multi";
    // This value refers to use whichever CPU architecture was selected for the cluster
    // It's not a value that can be returned from the Backend.
    CpuArchitecture["USE_DAY1_ARCHITECTURE"] = "cluster-day1-cpu-architecture";
    CpuArchitecture["ppc64le"] = "ppc64le";
    CpuArchitecture["s390x"] = "s390x";
})(CpuArchitecture || (exports.CpuArchitecture = CpuArchitecture = {}));
var OcmCpuArchitecture;
(function (OcmCpuArchitecture) {
    OcmCpuArchitecture["x86"] = "amd64";
    OcmCpuArchitecture["ARM"] = "arm64";
    OcmCpuArchitecture["MULTI"] = "multi";
    OcmCpuArchitecture["ppc64le"] = "ppc64le";
    OcmCpuArchitecture["s390x"] = "s390x";
})(OcmCpuArchitecture || (exports.OcmCpuArchitecture = OcmCpuArchitecture = {}));
exports.featureIdToCpuArchitecture = {
    ARM64_ARCHITECTURE: CpuArchitecture.ARM,
    PPC64LE_ARCHITECTURE: CpuArchitecture.ppc64le,
    S390X_ARCHITECTURE: CpuArchitecture.s390x,
    X86_64_ARCHITECTURE: CpuArchitecture.x86,
    MULTIARCH_RELEASE_IMAGE: CpuArchitecture.x86,
};
const getAllCpuArchitectures = () => [
    CpuArchitecture.x86,
    CpuArchitecture.ARM,
    CpuArchitecture.ppc64le,
    CpuArchitecture.s390x,
];
exports.getAllCpuArchitectures = getAllCpuArchitectures;
exports.architectureData = {
    [CpuArchitecture.x86]: {
        description: '',
        label: 'x86_64',
    },
    [CpuArchitecture.ARM]: {
        description: 'Some features may not be available',
        featureSupportLevelId: 'ARM64_ARCHITECTURE',
        label: 'Arm64',
    },
    [CpuArchitecture.ppc64le]: {
        description: 'Some features may not be available',
        featureSupportLevelId: 'PPC64LE_ARCHITECTURE',
        label: 'IBM Power (ppc64le)',
    },
    [CpuArchitecture.s390x]: {
        description: 'Some features may not be available',
        featureSupportLevelId: 'S390X_ARCHITECTURE',
        label: 'IBM Z (s390x)',
    },
};
const getSupportedCpuArchitectures = (cpuArchitectures, day1CpuArchitecture) => {
    const newSupportedCpuArchs = [];
    //Power clusters can be only homogeneous clusters
    if (day1CpuArchitecture === CpuArchitecture.ppc64le) {
        newSupportedCpuArchs.push(day1CpuArchitecture);
    }
    else {
        cpuArchitectures.forEach((cpuArch) => {
            if (day1CpuArchitecture === undefined && cpuArch === CpuArchitecture.ppc64le) {
                newSupportedCpuArchs.push(cpuArch);
            }
            else if (cpuArch !== CpuArchitecture.MULTI &&
                cpuArch !== CpuArchitecture.USE_DAY1_ARCHITECTURE) {
                newSupportedCpuArchs.push(cpuArch);
            }
        });
    }
    return newSupportedCpuArchs;
};
exports.getSupportedCpuArchitectures = getSupportedCpuArchitectures;
const getDefaultCpuArchitecture = () => CpuArchitecture.x86;
exports.getDefaultCpuArchitecture = getDefaultCpuArchitecture;
const getDisabledReasonForCpuArch = (cpuArchLabel, isMultiArchSupported) => {
    if (!isMultiArchSupported) {
        return `You don't have permissions to use multiple CPU architectures`;
    }
    else {
        return `${cpuArchLabel} is not supported in this OpenShift version`;
    }
};
exports.getDisabledReasonForCpuArch = getDisabledReasonForCpuArch;
//# sourceMappingURL=cpuArchitecture.js.map