{{!

  Copyright (c) Meta Platforms, Inc. and affiliates.

  Licensed under the Apache License, Version 2.0 (the "License");
  you may not use this file except in compliance with the License.
  You may obtain a copy of the License at

      http://www.apache.org/licenses/LICENSE-2.0

  Unless required by applicable law or agreed to in writing, software
  distributed under the License is distributed on an "AS IS" BASIS,
  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  See the License for the specific language governing permissions and
  limitations under the License.

}}
{{> AutoGenerated}}

package {{service:javaPackage}};

import com.facebook.swift.codec.*;
import com.facebook.swift.codec.ThriftField.Requiredness;
import com.facebook.swift.service.*;
import com.facebook.thrift.client.*;
import com.google.common.util.concurrent.ListenableFuture;
import java.io.*;
import java.util.*;
import reactor.core.publisher.Mono;

@SwiftGenerated
@com.facebook.swift.service.ThriftService("{{service:javaCapitalName}}")
public interface {{service:javaCapitalName}} extends java.io.Closeable, com.facebook.thrift.util.BlockingService{{#service:extends}}, {{service:javaPackage}}.{{service:javaCapitalName}}{{/service:extends}} {
    static com.facebook.thrift.server.RpcServerHandlerBuilder<{{service:javaCapitalName}}> serverHandlerBuilder({{service:javaCapitalName}} _serverImpl) {
        return new com.facebook.thrift.server.RpcServerHandlerBuilder<{{service:javaCapitalName}}>(_serverImpl) {
                @java.lang.Override
                public com.facebook.thrift.server.RpcServerHandler build() {
                return new {{service:javaCapitalName}}RpcServerHandler(impl, eventHandlers);
            }
        };
    }

    static com.facebook.thrift.client.ClientBuilder<{{service:javaCapitalName}}> clientBuilder() {
        return new ClientBuilder<{{service:javaCapitalName}}>() {
            @java.lang.Override
            public {{service:javaCapitalName}} build(Mono<RpcClient> rpcClientMono) {
                {{service:javaCapitalName}}.Reactive _delegate =
                    new {{service:javaCapitalName}}ReactiveClient(protocolId, rpcClientMono, headersMono, persistentHeadersMono);
                return new {{service:javaCapitalName}}ReactiveBlockingWrapper(_delegate);
            }
        };
    }

    @com.facebook.swift.service.ThriftService("{{service:javaCapitalName}}")
    public interface Async extends java.io.Closeable, com.facebook.thrift.util.AsyncService{{#service:extends}}, {{service:javaPackage}}.{{service:javaCapitalName}}.Async{{/service:extends}} {
        static com.facebook.thrift.server.RpcServerHandlerBuilder<{{service:javaCapitalName}}.Async> serverHandlerBuilder({{service:javaCapitalName}}.Async _serverImpl) {
            return new com.facebook.thrift.server.RpcServerHandlerBuilder<{{service:javaCapitalName}}.Async>(_serverImpl) {
                @java.lang.Override
                public com.facebook.thrift.server.RpcServerHandler build() {
                    return new {{service:javaCapitalName}}RpcServerHandler(impl, eventHandlers);
                }
            };
        }

        static com.facebook.thrift.client.ClientBuilder<{{service:javaCapitalName}}.Async> clientBuilder() {
            return new ClientBuilder<{{service:javaCapitalName}}.Async>() {
                @java.lang.Override
                public {{service:javaCapitalName}}.Async build(Mono<RpcClient> rpcClientMono) {
                    {{service:javaCapitalName}}.Reactive _delegate =
                        new {{service:javaCapitalName}}ReactiveClient(protocolId, rpcClientMono, headersMono, persistentHeadersMono);
                    return new {{service:javaCapitalName}}ReactiveAsyncWrapper(_delegate);
                }
            };
        }

        @java.lang.Override void close();

        {{#service:singleRequestFunctions}}
        @ThriftMethod(value = "{{function:name}}"{{#function:oneway?}},
                      oneway = true{{/function:oneway?}}{{#function:exceptions}}{{#first?}},
                      exception = { {{/first?}}
                          @ThriftException(type={{#field:type}}{{> Type}}{{/field:type}}.class, id={{field:key}}){{^last?}},{{/last?}}{{#last?}}
                      }{{/last?}}{{/function:exceptions}})
        ListenableFuture<{{#function:return_type}}{{> BoxedType}}{{/function:return_type}}> {{function:javaName}}({{#function:args}}
            @com.facebook.swift.codec.ThriftField(value={{field:key}}, {{#field:negativeId?}}isLegacyId=true, {{/field:negativeId?}}name="{{field:name}}", requiredness={{> Requiredness}}) final {{#field:type}}{{> Type}}{{/field:type}} {{field:javaName}}{{^last?}},{{/last?}}{{/function:args}});

        default ListenableFuture<{{#function:return_type}}{{> BoxedType}}{{/function:return_type}}> {{function:javaName}}({{#function:args}}
            @com.facebook.swift.codec.ThriftField(value={{field:key}}, {{#field:negativeId?}}isLegacyId=true, {{/field:negativeId?}}name="{{field:name}}", requiredness={{> Requiredness}}) final {{#field:type}}{{> Type}}{{/field:type}} {{field:javaName}},{{/function:args}}
            RpcOptions rpcOptions) {
            throw new UnsupportedOperationException();
        }

        default ListenableFuture<ResponseWrapper<{{#function:return_type}}{{> BoxedType}}{{/function:return_type}}>> {{function:javaName}}Wrapper({{#function:args}}
            @com.facebook.swift.codec.ThriftField(value={{field:key}}, {{#field:negativeId?}}isLegacyId=true, {{/field:negativeId?}}name="{{field:name}}", requiredness={{> Requiredness}}) final {{#field:type}}{{> Type}}{{/field:type}} {{field:javaName}},{{/function:args}}
            RpcOptions rpcOptions) {
            throw new UnsupportedOperationException();
        }
        {{^last?}}

        {{/last?}}
        {{/service:singleRequestFunctions}}
        {{#service:interactions}}
        @com.facebook.swift.service.ThriftInteraction("{{service:name}}")
        public interface {{service:name}} extends java.io.Closeable {
            {{#service:singleRequestFunctions}}
            @ThriftMethod(value = "{{function:name}}"{{#function:oneway?}},
                oneway = true{{/function:oneway?}}{{#function:exceptions}}{{#first?}},
                exception = { {{/first?}}
                    @ThriftException(type={{#field:type}}{{> Type}}{{/field:type}}.class, id={{field:key}}){{^last?}},{{/last?}}{{#last?}}
                }{{/last?}}{{/function:exceptions}})
            ListenableFuture<{{#function:return_type}}{{> BoxedType}}{{/function:return_type}}> {{function:javaName}}({{#function:args}} {{#field:type}}{{> Type}}{{/field:type}} {{field:javaName}}{{^last?}},{{/last?}}{{/function:args}});

            ListenableFuture<{{#function:return_type}}{{> BoxedType}}{{/function:return_type}}> {{function:javaName}}({{#function:args}}
                @com.facebook.swift.codec.ThriftField(value={{field:key}}, {{#field:negativeId?}}isLegacyId=true, {{/field:negativeId?}}name="{{field:name}}", requiredness={{> Requiredness}}) final {{#field:type}}{{> Type}}{{/field:type}} {{field:javaName}},{{/function:args}}
                RpcOptions rpcOptions);

            ListenableFuture<ResponseWrapper<{{#function:return_type}}{{> BoxedType}}{{/function:return_type}}>> {{function:javaName}}Wrapper({{#function:args}}
                @com.facebook.swift.codec.ThriftField(value={{field:key}}, {{#field:negativeId?}}isLegacyId=true, {{/field:negativeId?}}name="{{field:name}}", requiredness={{> Requiredness}}) final {{#field:type}}{{> Type}}{{/field:type}} {{field:javaName}},{{/function:args}}
                RpcOptions rpcOptions);
            {{/service:singleRequestFunctions}}

            @java.lang.Override
            void close();
        }

        public {{service:name}} create{{service:name}}();
        {{^last?}}

        {{/last?}}
        {{/service:interactions}}
    }
    @java.lang.Override void close();
    {{#service:singleRequestFunctions}}

    @ThriftMethod(value = "{{function:name}}"{{#function:oneway?}},
                  oneway = true{{/function:oneway?}}{{#function:exceptions}}{{#first?}},
                  exception = { {{/first?}}
                      @ThriftException(type={{#field:type}}{{> Type}}{{/field:type}}.class, id={{field:key}}){{^last?}},{{/last?}}{{#last?}}
                  }{{/last?}}{{/function:exceptions}})
    {{#function:return_type}}{{> Type}}{{/function:return_type}} {{function:javaName}}({{#function:args}}
        @com.facebook.swift.codec.ThriftField(value={{field:key}}, {{#field:negativeId?}}isLegacyId=true, {{/field:negativeId?}}name="{{field:name}}", requiredness={{> Requiredness}}) final {{#field:type}}{{> Type}}{{/field:type}} {{field:javaName}}{{^last?}},{{/last?}}{{/function:args}}){{!
          Exceptions
        }} throws {{#function:exceptions}}{{#field:type}}{{> BoxedType}}{{/field:type}}, {{/function:exceptions}}org.apache.thrift.TException;

    default {{#function:return_type}}{{> Type}}{{/function:return_type}} {{function:javaName}}({{#function:args}}
        @com.facebook.swift.codec.ThriftField(value={{field:key}}, {{#field:negativeId?}}isLegacyId=true, {{/field:negativeId?}}name="{{field:name}}", requiredness={{> Requiredness}}) final {{#field:type}}{{> Type}}{{/field:type}} {{field:javaName}},{{/function:args}}
        RpcOptions rpcOptions){{!
          Exceptions
        }} throws {{#function:exceptions}}{{#field:type}}{{> BoxedType}}{{/field:type}}, {{/function:exceptions}}org.apache.thrift.TException {
        throw new UnsupportedOperationException();
    }

    default ResponseWrapper<{{#function:return_type}}{{> BoxedType}}{{/function:return_type}}> {{function:javaName}}Wrapper({{#function:args}}
        @com.facebook.swift.codec.ThriftField(value={{field:key}}, {{#field:negativeId?}}isLegacyId=true, {{/field:negativeId?}}name="{{field:name}}", requiredness={{> Requiredness}}) final {{#field:type}}{{> Type}}{{/field:type}} {{field:javaName}},{{/function:args}}
        RpcOptions rpcOptions){{!
          Exceptions
        }} throws {{#function:exceptions}}{{#field:type}}{{> BoxedType}}{{/field:type}}, {{/function:exceptions}}org.apache.thrift.TException {
        throw new UnsupportedOperationException();
    }
    {{/service:singleRequestFunctions}}

    @com.facebook.swift.service.ThriftService("{{service:javaCapitalName}}")
    interface Reactive extends reactor.core.Disposable, com.facebook.thrift.util.ReactiveService{{#service:extends}}, {{service:javaPackage}}.{{service:javaCapitalName}}.Reactive{{/service:extends}} {
        static com.facebook.thrift.server.RpcServerHandlerBuilder<{{service:javaCapitalName}}.Reactive> serverHandlerBuilder({{service:javaCapitalName}}.Reactive _serverImpl) {
            return new com.facebook.thrift.server.RpcServerHandlerBuilder<{{service:javaCapitalName}}.Reactive>(_serverImpl) {
                @java.lang.Override
                public com.facebook.thrift.server.RpcServerHandler build() {
                    return new {{service:javaCapitalName}}RpcServerHandler(impl, eventHandlers);
                }
            };
        }

        static com.facebook.thrift.client.ClientBuilder<{{service:javaCapitalName}}.Reactive> clientBuilder() {
            return new ClientBuilder<{{service:javaCapitalName}}.Reactive>() {
                @java.lang.Override
                public {{service:javaCapitalName}}.Reactive build(Mono<RpcClient> rpcClientMono) {
                    return new {{service:javaCapitalName}}ReactiveClient(protocolId, rpcClientMono, headersMono, persistentHeadersMono);
                }
            };
        }

        {{#service:singleRequestFunctions}}
        @ThriftMethod(value = "{{function:name}}"{{#function:oneway?}},
                  oneway = true{{/function:oneway?}}{{#function:exceptions}}{{#first?}},
                  exception = { {{/first?}}
                      @ThriftException(type={{#field:type}}{{> Type}}{{/field:type}}.class, id={{field:key}}){{^last?}},{{/last?}}{{#last?}}
                  }{{/last?}}{{/function:exceptions}})
        reactor.core.publisher.Mono<{{#function:return_type}}{{> BoxedType}}{{/function:return_type}}> {{function:javaName}}({{#function:args}}final {{#field:type}}{{> Type}}{{/field:type}} {{field:javaName}}{{^last?}}, {{/last?}}{{/function:args}});

        default reactor.core.publisher.Mono<{{#function:return_type}}{{> BoxedType}}{{/function:return_type}}> {{function:javaName}}({{#function:args}}final {{#field:type}}{{> Type}}{{/field:type}} {{field:javaName}}, {{/function:args}}RpcOptions rpcOptions) {
            throw new UnsupportedOperationException();
        }

        default reactor.core.publisher.Mono<ResponseWrapper<{{#function:return_type}}{{> BoxedType}}{{/function:return_type}}>> {{function:javaName}}Wrapper({{#function:args}}final {{#field:type}}{{> Type}}{{/field:type}} {{field:javaName}}, {{/function:args}}RpcOptions rpcOptions) {
            throw new UnsupportedOperationException();
        }

        {{/service:singleRequestFunctions}}
        {{#service:streamingFunctions}}
        reactor.core.publisher.Flux<{{#function:return_type}}{{> StreamReturnType}}{{/function:return_type}}> {{function:javaName}}({{#function:args}}final {{#field:type}}{{> Type}}{{/field:type}} {{field:javaName}}{{^last?}}, {{/last?}}{{/function:args}});

        default reactor.core.publisher.Flux<{{#function:return_type}}{{> StreamReturnType}}{{/function:return_type}}> {{function:javaName}}({{#function:args}}final {{#field:type}}{{> Type}}{{/field:type}} {{field:javaName}}, {{/function:args}}RpcOptions rpcOptions) {
            throw new UnsupportedOperationException();
        }

        default reactor.core.publisher.Flux<ResponseWrapper<{{#function:return_type}}{{> StreamReturnType}}{{/function:return_type}}>> {{function:javaName}}Wrapper({{#function:args}}final {{#field:type}}{{> Type}}{{/field:type}} {{field:javaName}}, {{/function:args}}RpcOptions rpcOptions) {
            throw new UnsupportedOperationException();
        }

        {{/service:streamingFunctions}}
        {{#service:sinkFunctions}}
        {{#function:return_type}}{{> SinkReturnType}}{{/function:return_type}} {{function:javaName}}({{#function:args}}final {{#field:type}}{{> Type}}{{/field:type}} {{field:javaName}}, {{/function:args}} org.reactivestreams.Publisher<{{#function:return_type}}{{#function:sink_elem_type}}{{ >BoxedType}}{{/function:sink_elem_type}}{{/function:return_type}}> payloads);

        default {{#function:return_type}}{{> SinkReturnType}}{{/function:return_type}} {{function:javaName}}({{#function:args}}final {{#field:type}}{{> Type}}{{/field:type}} {{field:javaName}}, {{/function:args}} org.reactivestreams.Publisher<{{#function:return_type}}{{#function:sink_elem_type}}{{ >BoxedType}}{{/function:sink_elem_type}}{{/function:return_type}}> payloads, RpcOptions rpcOptions) {
            throw new UnsupportedOperationException();
        }

        default {{#function:return_type}}{{> SinkWrapperReturnType}}{{/function:return_type}} {{function:javaName}}Wrapper({{#function:args}}final {{#field:type}}{{> Type}}{{/field:type}} {{field:javaName}}, {{/function:args}} org.reactivestreams.Publisher<{{#function:return_type}}{{#function:sink_elem_type}}{{ >BoxedType}}{{/function:sink_elem_type}}{{/function:return_type}}> payloads, RpcOptions rpcOptions) {
            throw new UnsupportedOperationException();
        }

        {{/service:sinkFunctions}}
        {{#service:interactions}}
        @com.facebook.swift.service.ThriftInteraction("{{service:name}}")
        public interface {{service:name}} extends reactor.core.Disposable {
            {{#service:singleRequestFunctions}}
            @ThriftMethod(value = "{{function:name}}"{{#function:oneway?}},
                oneway = true{{/function:oneway?}}{{#function:exceptions}}{{#first?}},
                exception = { {{/first?}}
                    @ThriftException(type={{#field:type}}{{> Type}}{{/field:type}}.class, id={{field:key}}){{^last?}},{{/last?}}{{#last?}}
                }{{/last?}}{{/function:exceptions}})
            reactor.core.publisher.Mono<{{#function:return_type}}{{> BoxedType}}{{/function:return_type}}> {{function:javaName}}({{#function:args}} final {{#field:type}}{{> Type}}{{/field:type}} {{field:javaName}}{{^last?}},{{/last?}}{{/function:args}});

            reactor.core.publisher.Mono<{{#function:return_type}}{{> BoxedType}}{{/function:return_type}}> {{function:javaName}}({{#function:args}}final {{#field:type}}{{> Type}}{{/field:type}} {{field:javaName}}, {{/function:args}}RpcOptions rpcOptions);

            reactor.core.publisher.Mono<ResponseWrapper<{{#function:return_type}}{{> BoxedType}}{{/function:return_type}}>> {{function:javaName}}Wrapper({{#function:args}}final {{#field:type}}{{> Type}}{{/field:type}} {{field:javaName}}, {{/function:args}}RpcOptions rpcOptions);

            {{/service:singleRequestFunctions}}
            {{#service:streamingFunctions}}
            reactor.core.publisher.Flux<{{#function:return_type}}{{> StreamReturnType}}{{/function:return_type}}> {{function:javaName}}({{#function:args}}final {{#field:type}}{{> Type}}{{/field:type}} {{field:javaName}}{{^last?}}, {{/last?}}{{/function:args}});

            default reactor.core.publisher.Flux<{{#function:return_type}}{{> StreamReturnType}}{{/function:return_type}}> {{function:javaName}}({{#function:args}}final {{#field:type}}{{> Type}}{{/field:type}} {{field:javaName}}, {{/function:args}}RpcOptions rpcOptions) {
                throw new UnsupportedOperationException();
            }

            default reactor.core.publisher.Flux<ResponseWrapper<{{#function:return_type}}{{> StreamReturnType}}{{/function:return_type}}>> {{function:javaName}}Wrapper({{#function:args}}final {{#field:type}}{{> Type}}{{/field:type}} {{field:javaName}}, {{/function:args}}RpcOptions rpcOptions) {
                throw new UnsupportedOperationException();
            }

            {{/service:streamingFunctions}}
            @java.lang.Override
            void dispose();
        }

        public {{service:name}} create{{service:name}}();
        {{^last?}}

        {{/last?}}
        {{/service:interactions}}
    }
    {{#service:interactions}}
    @com.facebook.swift.service.ThriftInteraction("{{service:name}}")
    public interface {{service:name}} extends java.io.Closeable {
        {{#service:singleRequestFunctions}}
        @ThriftMethod(value = "{{function:name}}"{{#function:oneway?}},
                      oneway = true{{/function:oneway?}}{{#function:exceptions}}{{#first?}},
                      exception = { {{/first?}}
                          @ThriftException(type={{#field:type}}{{> Type}}{{/field:type}}.class, id={{field:key}}){{^last?}},{{/last?}}{{#last?}}
                      }{{/last?}}{{/function:exceptions}})
        {{#function:return_type}}{{> Type}}{{/function:return_type}} {{function:javaName}}({{#function:args}}
        @com.facebook.swift.codec.ThriftField(value={{field:key}}, {{#field:negativeId?}}isLegacyId=true, {{/field:negativeId?}}name="{{field:name}}", requiredness={{> Requiredness}}) final {{#field:type}}{{> Type}}{{/field:type}} {{field:javaName}}{{^last?}},{{/last?}}{{/function:args}}) throws {{#function:exceptions}}{{#field:type}}{{> BoxedType}}{{/field:type}}, {{/function:exceptions}}org.apache.thrift.TException;

        {{#function:return_type}}{{> Type}}{{/function:return_type}} {{function:javaName}}({{#function:args}}
            @com.facebook.swift.codec.ThriftField(value={{field:key}}, {{#field:negativeId?}}isLegacyId=true, {{/field:negativeId?}}name="{{field:name}}", requiredness={{> Requiredness}}) final {{#field:type}}{{> Type}}{{/field:type}} {{field:javaName}},{{/function:args}}
            RpcOptions rpcOptions){{!
            Exceptions
            }} throws {{#function:exceptions}}{{#field:type}}{{> BoxedType}}{{/field:type}}, {{/function:exceptions}}org.apache.thrift.TException;

        ResponseWrapper<{{#function:return_type}}{{> BoxedType}}{{/function:return_type}}> {{function:javaName}}Wrapper({{#function:args}}
            @com.facebook.swift.codec.ThriftField(value={{field:key}}, {{#field:negativeId?}}isLegacyId=true, {{/field:negativeId?}}name="{{field:name}}", requiredness={{> Requiredness}}) final {{#field:type}}{{> Type}}{{/field:type}} {{field:javaName}},{{/function:args}}
            RpcOptions rpcOptions){{!
            Exceptions
            }} throws {{#function:exceptions}}{{#field:type}}{{> BoxedType}}{{/field:type}}, {{/function:exceptions}}org.apache.thrift.TException;
        {{/service:singleRequestFunctions}}

        @java.lang.Override void close();
    }

    {{service:name}} create{{service:name}}();
    {{^last?}}

    {{/last?}}
    {{/service:interactions}}
}
