"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.HttpMethodType = exports.AdditionalApi = void 0;
class AdditionalApi {
    get getApiFileName() {
        return this.pathBoundedContext.toKebabCase() + '-' + this.pathAction.toKebabCase() + '-' + this.pathSegments.join('-');
    }
    get getClassName() {
        return this.pathBoundedContext.toPascalCase() + this.pathAction.toPascalCase() + this.pathSegments.map(segment => segment.toPascalCase()).join('');
    }
    get getResolverName() {
        return this.pathBoundedContext.toCamelCase() + this.pathAction.toPascalCase() + this.pathSegments.map(segment => segment.toPascalCase()).join('');
    }
    get getVariableName() {
        return this.pathAction.toCamelCase() + this.pathSegments.map(segment => segment.toPascalCase()).join('');
    }
    constructor(payload) {
        this.path = payload.path;
        this.resolverType = payload.resolverType;
        this.httpMethod = payload.httpMethod;
        this.pathSegments = payload.path.split('/').map(segment => segment.toKebabCase());
        if (!Array.isArray(this.pathSegments))
            throw new Error('Invalid path');
        if (this.pathSegments.length < 3)
            throw new Error('Invalid path');
        this.pathBoundedContext = this.pathSegments.shift();
        this.pathAction = this.pathSegments.pop();
    }
    toDto() {
        return {
            path: this.path,
            resolverType: this.resolverType,
            httpMethod: this.httpMethod,
        };
    }
}
exports.AdditionalApi = AdditionalApi;
var HttpMethodType;
(function (HttpMethodType) {
    HttpMethodType["GET"] = "get";
    HttpMethodType["HEAD"] = "head";
    HttpMethodType["POST"] = "post";
    HttpMethodType["PUT"] = "put";
    HttpMethodType["DELETE"] = "delete";
    HttpMethodType["CONNECT"] = "connect";
    HttpMethodType["OPTIONS"] = "options";
    HttpMethodType["TRACE"] = "trace";
    HttpMethodType["PATCH"] = "patch";
})(HttpMethodType = exports.HttpMethodType || (exports.HttpMethodType = {}));
