"use strict";
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
    if (k2 === undefined) k2 = k;
    Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
}) : (function(o, m, k, k2) {
    if (k2 === undefined) k2 = k;
    o[k2] = m[k];
}));
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
    Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
    o["default"] = v;
});
var __importStar = (this && this.__importStar) || function (mod) {
    if (mod && mod.__esModule) return mod;
    var result = {};
    if (mod != null) for (var k in mod) if (k !== "default" && Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
    __setModuleDefault(result, mod);
    return result;
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.isMethodDefinition = exports.MethodDefinition = void 0;
const Location = __importStar(require("./Location"));
const Null = __importStar(require("./ion/Null"));
const Expression = __importStar(require("./Expression"));
const Identifier = __importStar(require("./Identifier"));
const FunctionExpression = __importStar(require("./FunctionExpression"));
const String = __importStar(require("./ion/String"));
const Boolean = __importStar(require("./ion/Boolean"));
const Class = __importStar(require("./ion/Class"));
class MethodDefinition {
    constructor({ location = null, key, value, kind = 'method', computed = false, static: _static = false }) {
        if (!(Location.isLocation(location) || Null.isNull(location)))
            throw new Error('location is not a Location | Null: ' + Class.toString(location));
        if (!(Expression.isExpression(key) || Identifier.isIdentifier(key)))
            throw new Error('key is not a Expression | Identifier: ' + Class.toString(key));
        if (!FunctionExpression.isFunctionExpression(value))
            throw new Error('value is not a FunctionExpression: ' + Class.toString(value));
        if (!String.isString(kind))
            throw new Error('kind is not a String: ' + Class.toString(kind));
        if (!Boolean.isBoolean(computed))
            throw new Error('computed is not a Boolean: ' + Class.toString(computed));
        if (!Boolean.isBoolean(_static))
            throw new Error('static is not a Boolean: ' + Class.toString(_static));
        this.location = location;
        this.key = key;
        this.value = value;
        this.kind = kind;
        this.computed = computed;
        this.static = _static;
        Object.freeze(this);
    }
    patch(properties) {
        return new MethodDefinition({
            ...this,
            ...properties
        });
    }
    static is(value) {
        return isMethodDefinition(value);
    }
}
exports.MethodDefinition = MethodDefinition;
MethodDefinition.id = 'MethodDefinition';
MethodDefinition.implements = new Set([
    'MethodDefinition',
    'ion_Object',
    'Node'
]);
function isMethodDefinition(value) {
    return Class.isInstance(MethodDefinition, value);
}
exports.isMethodDefinition = isMethodDefinition;
exports.default = MethodDefinition;
