"use strict";
// SPDX-License-Identifier: Apache-2.0
Object.defineProperty(exports, "__esModule", { value: true });
exports.Factory = exports.Factories = exports.EnvironmentFactory = void 0;
const RegulationType_1 = require("./RegulationType");
const InvalidRegulationSubType_1 = require("./error/InvalidRegulationSubType");
const InvalidRegulationType_1 = require("./error/InvalidRegulationType");
class EnvironmentFactory {
    factory;
    environment;
    constructor(factory, environment) {
        this.factory = factory;
        this.environment = environment;
    }
}
exports.EnvironmentFactory = EnvironmentFactory;
class Factories {
    factories;
    constructor(factories) {
        this.factories = factories;
    }
}
exports.Factories = Factories;
class Factory {
    static checkRegulationType(value) {
        const errorList = [];
        const length = Object.keys(RegulationType_1.RegulationType).length;
        if (value >= length)
            errorList.push(new InvalidRegulationType_1.InvalidRegulationType(value));
        return errorList;
    }
    static checkRegulationSubType(value, type) {
        const errorList = [];
        const length = Object.keys(RegulationType_1.RegulationSubType).length;
        if (value >= length)
            errorList.push(new InvalidRegulationSubType_1.InvalidRegulationSubType(value));
        if (!RegulationType_1.CheckRegulations.typeAndSubtype(type, value))
            errorList.push(new InvalidRegulationSubType_1.InvalidRegulationSubTypeForType(value, type));
        return errorList;
    }
}
exports.Factory = Factory;
