syntax = "proto3";

package v1;

import "google/protobuf/wrappers.proto";
import "model.proto";

message Namespace {
	google.protobuf.StringValue name = 1;
	google.protobuf.StringValue comment = 2;
	google.protobuf.StringValue owners = 3;
	google.protobuf.StringValue token = 4;
	google.protobuf.StringValue ctime = 5;
	google.protobuf.StringValue mtime = 6;
}

message Service {
	google.protobuf.StringValue name = 1;
	google.protobuf.StringValue namespace = 2;

	map<string, string> metadata = 3;

	google.protobuf.StringValue ports = 4;
	google.protobuf.StringValue business = 5;
	google.protobuf.StringValue department = 6;
	google.protobuf.StringValue cmdb_mod1 = 7 [json_name="cmdb_mod1"];
	google.protobuf.StringValue cmdb_mod2 = 8 [json_name="cmdb_mod2"];
	google.protobuf.StringValue cmdb_mod3 = 9 [json_name="cmdb_mod3"];
	google.protobuf.StringValue comment = 10;
	google.protobuf.StringValue owners = 11;
	google.protobuf.StringValue token = 12;

	google.protobuf.StringValue ctime = 13;
	google.protobuf.StringValue mtime = 14;
	google.protobuf.StringValue revision = 15;
}

enum AliasType {
    DEFAULT = 0;
    CL5SID = 1;
}

message ServiceAlias {
    google.protobuf.StringValue service = 1;
    google.protobuf.StringValue namespace = 2;
    google.protobuf.StringValue alias = 3;
    AliasType type = 4;
    google.protobuf.StringValue owners = 8;
    google.protobuf.StringValue service_token = 5 [json_name="service_token"];

    google.protobuf.StringValue ctime = 6;
    google.protobuf.StringValue mtime = 7;
}

message Instance {
	google.protobuf.StringValue id = 1;
	google.protobuf.StringValue service = 2;
	google.protobuf.StringValue namespace = 3;
	google.protobuf.StringValue vpc_id = 21 [json_name="vpc_id"];
	google.protobuf.StringValue host = 4;
	google.protobuf.UInt32Value port = 5;
	google.protobuf.StringValue protocol = 6;
	google.protobuf.StringValue version = 7;
	google.protobuf.UInt32Value priority = 8;
	google.protobuf.UInt32Value weight = 9;
	google.protobuf.BoolValue enable_health_check = 20;
	HealthCheck health_check = 10;
	google.protobuf.BoolValue healthy = 11;
	google.protobuf.BoolValue isolate = 12;
	Location location = 13;

	map<string, string> metadata = 14;
	google.protobuf.StringValue logic_set = 15 [json_name="logic_set"];

	google.protobuf.StringValue ctime = 16;
	google.protobuf.StringValue mtime = 17;
	google.protobuf.StringValue revision = 18;

	google.protobuf.StringValue service_token = 19 [json_name="service_token"];
}

message HealthCheck {
	enum HealthCheckType {
		UNKNOWN = 0;
		HEARTBEAT = 1;
	}

	HealthCheckType type = 1;

	HeartbeatHealthCheck heartbeat = 2;
}

message HeartbeatHealthCheck {
	google.protobuf.UInt32Value ttl = 1;
}
