"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.RelationCardinalityMapper = void 0;
const relation_cardinality_1 = require("../contracts/base/relation-cardinality");
class RelationCardinalityMapper {
    static mapToEnumValue(value) {
        if (value === "ManyToMany") {
            return relation_cardinality_1.RelationCardinality.ManyToMany;
        }
        else if (value === "OneToMany") {
            return relation_cardinality_1.RelationCardinality.OneToMany;
        }
        else if (value === "OneToOne") {
            return relation_cardinality_1.RelationCardinality.OneToOne;
        }
        else {
            throw Error(`Can't map '${value}' to enum value.`);
        }
    }
    static mapToType(value) {
        if (value === relation_cardinality_1.RelationCardinality.ManyToMany || value === relation_cardinality_1.RelationCardinality[relation_cardinality_1.RelationCardinality.ManyToMany]) {
            return "ManyToMany";
        }
        else if (value === relation_cardinality_1.RelationCardinality.OneToMany ||
            value === relation_cardinality_1.RelationCardinality[relation_cardinality_1.RelationCardinality.OneToMany]) {
            return "OneToMany";
        }
        else if (value === relation_cardinality_1.RelationCardinality.OneToOne ||
            value === relation_cardinality_1.RelationCardinality[relation_cardinality_1.RelationCardinality.OneToOne]) {
            return "OneToOne";
        }
        else {
            throw Error(`Can't map '${value}' to type.`);
        }
    }
}
exports.RelationCardinalityMapper = RelationCardinalityMapper;
//# sourceMappingURL=relation-cardinality-mapper.js.map