"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var enum_1 = require("../changes/enum");
var arrays_1 = require("../utils/arrays");
function changesInEnum(oldEnum, newEnum) {
    var changes = [];
    var oldNames = oldEnum.getValues().map(function (v) { return v.value; });
    var newNames = newEnum.getValues().map(function (v) { return v.name; });
    var added = arrays_1.diffArrays(newNames, oldNames).map(function (name) { return newEnum.getValue(name); });
    var removed = arrays_1.diffArrays(oldNames, newNames).map(function (name) { return oldEnum.getValue(name); });
    var common = arrays_1.unionArrays(oldNames, newNames).map(function (name) { return ({
        oldValue: oldEnum.getValue(name),
        newValue: newEnum.getValue(name),
    }); });
    changes.push.apply(changes, added.map(function (v) { return enum_1.enumValueAdded(newEnum, v); }));
    changes.push.apply(changes, removed.map(function (v) { return enum_1.enumValueRemoved(oldEnum, v); }));
    common.forEach(function (_a) {
        var oldValue = _a.oldValue, newValue = _a.newValue;
        if (oldValue.description !== newValue.description) {
            changes.push(enum_1.enumValueDescriptionChanged(newEnum, oldValue, newValue));
        }
        if (oldValue.deprecationReason !== newValue.deprecationReason) {
            changes.push(enum_1.enumValueDeprecationReasonChanged(newEnum, oldValue, newValue));
        }
    });
    return changes;
}
exports.changesInEnum = changesInEnum;
//# sourceMappingURL=enum.js.map