@*
 * Licensed to the Apache Software Foundation (ASF) under one or more
 * license agreements; and to You under the Apache License, version 2.0:
 *
 *   https://www.apache.org/licenses/LICENSE-2.0
 *
 * This file is part of the Apache Pekko project, which was derived from Akka.
 *@

@*
 * Copyright (C) 2018-2021 Lightbend Inc. <https://www.lightbend.com>
 *@

@(service: org.apache.pekko.grpc.gen.javadsl.Service)

@org.apache.pekko.grpc.gen.Constants.DoNotEditComment
package @service.packageName;

import org.apache.pekko.grpc.ProtobufSerializer;
import org.apache.pekko.grpc.javadsl.GoogleProtobufSerializer;

import org.apache.pekko.grpc.PekkoGrpcGenerated;

@for(comment <- service.comment) {/**
@{java.util.regex.Pattern.compile("^\\s?(.*)$", java.util.regex.Pattern.MULTILINE).matcher(comment).replaceAll(" * $1")} */}
public interface @{service.name} {
  @for(method <- service.methods) {
  @for(comment <- method.comment) {/**
@{java.util.regex.Pattern.compile("^\\s?(.*)$", java.util.regex.Pattern.MULTILINE).matcher(comment).replaceAll("   * $1")}   */}
  @{method.getReturnType} @{method.name}(@{method.getParameterType} in);
  }

  static String name = "@service.grpcName";
  static org.apache.pekko.grpc.ServiceDescription description = new org.apache.pekko.grpc.internal.ServiceDescriptionImpl(name, @service.descriptor);

  @@PekkoGrpcGenerated
  public static class Serializers {
    @for(serializer <- service.serializers) {
      public static ProtobufSerializer<@{serializer.messageType}> @serializer.name = @serializer.init;
    }
  }
}
