"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var change_1 = require("./change");
var graphql_1 = require("../utils/graphql");
function fieldArgumentDescriptionChanged(type, field, oldArg, newArg) {
    return {
        criticality: {
            level: change_1.CriticalityLevel.NonBreaking,
        },
        message: "Description for argument '" + newArg.name + "' on field '" + type.name + "." + field.name + "' changed from '" + oldArg.description + "' to '" + newArg.description + "'",
        path: [type.name, field.name, oldArg.name].join('.'),
    };
}
exports.fieldArgumentDescriptionChanged = fieldArgumentDescriptionChanged;
function fieldArgumentDefaultChanged(type, field, oldArg, newArg) {
    return {
        criticality: {
            level: change_1.CriticalityLevel.Dangerous,
            reason: 'Changing the default value for an argument may change the runtime behaviour of a field if it was never provided.',
        },
        message: typeof oldArg.defaultValue === 'undefined'
            ? "Default value '" + newArg.defaultValue + "' was added to argument '" + newArg.name + "' on field '" + type.name + "." + field.name + "'"
            : "Default value for argument '" + newArg.name + "' on field '" + type.name + "." + field.name + "' changed from '" + oldArg.defaultValue + "' to '" + newArg.defaultValue + "'",
        path: [type.name, field.name, oldArg.name].join('.'),
    };
}
exports.fieldArgumentDefaultChanged = fieldArgumentDefaultChanged;
function fieldArgumentTypeChanged(type, field, oldArg, newArg) {
    return {
        criticality: graphql_1.safeChangeForInputValue(oldArg.type, newArg.type)
            ? {
                level: change_1.CriticalityLevel.NonBreaking,
                reason: "Changing an input field from non-null to null is considered non-breaking.",
            }
            : {
                level: change_1.CriticalityLevel.Breaking,
                reason: "Changing the type of a field's argument can cause existing queries that use this argument to error.",
            },
        message: "Type for argument '" + newArg.name + "' on field '" + type.name + "." + field.name + "' changed from '" + oldArg.type + "' to '" + newArg.type + "'",
        path: [type.name, field.name, oldArg.name].join('.'),
    };
}
exports.fieldArgumentTypeChanged = fieldArgumentTypeChanged;
//# sourceMappingURL=argument.js.map