syntax = "proto3";

package test;

option go_package = "go.unistack.org/micro-tests/server/http/proto;pb";

import "tag/tag.proto";
import "api/annotations.proto";
import "openapiv3/annotations.proto";
import "google/protobuf/wrappers.proto";

service TestDouble {
  //option (micro.api.micro_service) = { client_wrappers: ["one","two"]; };
	rpc CallDouble(CallReq) returns (CallRsp) {
		option (micro.openapiv3.openapiv3_operation) = {
      operation_id: "Call";
      responses: {
        default: {
          reference: {
            _ref: ".test.Error";
          };
        };
      };
    };
		option (micro.api.http) = { post: "/v1/testdouble/call/name/{name}"; body: "*"; };
		option (micro.api.micro_method) = { timeout: "5s"; };
  };
};

service Test {
	rpc CallRepeatedString(CallReq) returns (CallRsp) {
		option (micro.openapiv3.openapiv3_operation) = {
      operation_id: "CallRepeatedString";
      responses: {
        default: {
          reference: {
            _ref: ".test.Error";
          };
        };
      };
    };
		option (micro.api.http) = { post: "/v1/test/call_repeated_string"; body: "*"; };
		option (micro.api.micro_method) = { timeout: "5s"; };
  };
	rpc CallRepeatedInt64(CallReq) returns (CallRsp) {
		option (micro.openapiv3.openapiv3_operation) = {
      operation_id: "CallRepeatedInt64";
      responses: {
        default: {
          reference: {
            _ref: ".test.Error";
          };
        };
      };
    };
		option (micro.api.http) = { post: "/v1/test/call_repeated_int64"; body: "*"; };
		option (micro.api.micro_method) = { timeout: "5s"; };
  };


  //option (micro.api.micro_service) = { client_wrappers: ["one","two"]; };
	rpc Call(CallReq) returns (CallRsp) {
    option (micro.openapiv3.openapiv3_operation) = {
			operation_id: "Call";
      responses: {
        default: {
          reference: {
            _ref: ".test.Error";
          };
        };
      };
			parameters: {
				parameter: {
				  name: "Clientid";
				  in: "header";
				  schema: {
						schema: {
					  	type: "string";
						};
					};
				  required: true;
			  };
		  };
			parameters: {
				parameter: {
				  name: "Csrftoken";
				  in: "cookie";
				  schema: {
						schema: {
					  	type: "string";
						};
					};
				  required: true;
			  };
		  };
		};
		option (micro.api.http) = { post: "/v1/test/call/{name}"; body: "*"; };
		option (micro.api.micro_method) = { timeout: "5s"; };
  };
	rpc CallError(CallReq1) returns (CallRsp1) {
		option (micro.openapiv3.openapiv3_operation) = {
      operation_id: "CallError";
      responses: {
        default: {
          reference: {
            _ref: ".test.Error";
          };
        };
      };
    };
		option (micro.api.http) = { post: "/v1/test/callerror/{name}"; body: "*"; };
  };

};

message CallReq {
  string name = 1 [(micro.tag.tags) = "xml:\",attr\"" ];
  string req = 2;
  string arg1 = 3;
  uint64 arg2 = 4;
  Nested nested = 5;
  repeated string string_ids = 6;
  repeated int64 int64_ids = 7;
  string Clientid = 8;
  string Csrftoken = 9;
};

message Nested {
  repeated string string_args = 1;
  repeated google.protobuf.UInt64Value uint64_args = 2;
}

message CallRsp {
  string rsp = 2;
};

message CallReq1 {
  string name = 1;
  string req = 2;
};

message CallRsp1 {
  string rsp = 2;
};


message Error {
	string msg = 1;
};