"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.RelayBuilder = void 0;
class RelayBuilder {
    relay;
    constructor() {
        this.relay = { headers: [], query: [], body: [] };
    }
    build() {
        return this.relay;
    }
    /**
     * Relay a request header using a different name.
     * Header relay rules aren't case-sensitive because http headers aren't case sensitive.
     * @param from The name of the request header to relay from the incoming request.
     * @param to   The new name of the request header to relay to the outgoing request.
     */
    relayHeaderRename(from, to) {
        this.relay.headers.push({ [from.toLowerCase()]: to.toLowerCase() });
        return this;
    }
    /**
     * Relay request headers using the same names.
     * @param from The names of the incoming request headers to relay from.
     *
     * Header relay rules aren't case-sensitive because http headers aren't case sensitive.
     */
    relayHeaders(from) {
        this.relay.headers.push(...from);
        return this;
    }
    /**
     * Relay a request query parameter using a different name.
     * @param from The name of the request query parameter to relay from the incoming request.
     * @param to   The new name of the request query parameter to relay to the outgoing request.
     */
    relayQueryRename(from, to) {
        this.relay.query.push({ [from]: to });
        return this;
    }
    /**
     * Relay request query parameters using the same names.
     * @param from The names of the incoming request query parameters to relay from.
     */
    relayQuery(from) {
        this.relay.query.push(...from);
        return this;
    }
    /**
     * Relay request a query body field using a different name.
     * @param from The name of the request body field to relay from the incoming request.
     * @param to   The new name of the request body field to relay to the outgoing request.
     */
    relayBodyRename(from, to) {
        this.relay.body.push({ [from]: to });
        return this;
    }
    /**
     * Relay query body fields using the same names.
     * @param from: The names of the incoming request body fields to relay from.
     */
    relayBody(from) {
        this.relay.body.push(...from);
        return this;
    }
}
exports.RelayBuilder = RelayBuilder;
//# sourceMappingURL=builder.js.map