const require_endpoint = require('./endpoint.cjs');
const require_generic = require('./handlers/generic.cjs');
const require_fetch = require('./handlers/fetch.cjs');

//#region src/endpoint/fetch_endpoint.ts
var FetchEndpointImpl = class {
	constructor(protocolMode) {
		this.protocolMode = protocolMode;
	}
	builder = new require_endpoint.EndpointBuilder();
	bind(definition) {
		this.builder.bind(definition);
		return this;
	}
	withIdentityV1(...keys) {
		this.builder.addIdentityKeys(...keys);
		return this;
	}
	defaultServiceOptions(options) {
		this.builder.setDefaultServiceOptions(options);
		return this;
	}
	setLogger(newLogger) {
		this.builder.setLogger(newLogger);
		return this;
	}
	bidirectional(set = true) {
		this.protocolMode = set ? "BIDI_STREAM" : "REQUEST_RESPONSE";
		return this;
	}
	journalValueCodecProvider(codecProvider) {
		this.builder.setJournalValueCodecProvider(codecProvider);
		return this;
	}
	handler() {
		return require_fetch.fetcher(require_generic.createRestateHandler(this.builder.build(), this.protocolMode, {}));
	}
};

//#endregion
exports.FetchEndpointImpl = FetchEndpointImpl;