import { EndpointBuilder } from "./endpoint.js";
import { createRestateHandler } from "./handlers/generic.js";
import { fetcher } from "./handlers/fetch.js";

//#region src/endpoint/fetch_endpoint.ts
var FetchEndpointImpl = class {
	constructor(protocolMode) {
		this.protocolMode = protocolMode;
	}
	builder = new 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 fetcher(createRestateHandler(this.builder.build(), this.protocolMode, {}));
	}
};

//#endregion
export { FetchEndpointImpl };
//# sourceMappingURL=fetch_endpoint.js.map