syntax = "proto2";

package harness;

import "google/protobuf/descriptor.proto";
import "validate/validate.proto";

message Mark {
    enum Protocol {
        TCP = 0;
        HTTP = 1;
        GRPC = 2;
    }
    optional Protocol protocol = 1;
}

message Input {
    enum Reach {
        LOCALHOST = 0;
        NAMESPACE = 1;
        CLUSTER = 2;
        EXTERNAL = 3;
    }
    required string type = 1 [(validate.rules).string.min_len = 1];
    optional Reach reach = 2;
}

message Output {
    enum Expose {
        PRIVATE = 0;
        HEADLESS = 1;
        INTERNAL = 2;
        PUBLIC = 3;
    }
    required string type = 1 [(validate.rules).string.min_len = 1];
    optional Expose expose = 2;
}

message Wire {
    oneof type {
        option (validate.required) = true;
        Input input = 1;
        Output output = 2;
    }
}

extend google.protobuf.FieldOptions {
    optional Wire wire = 2001;
    optional Mark mark = 2002;
}

message Service {
    message Resource {
        optional string cpu = 1;
        optional string memory = 2;
    }
    message Resources {
        optional Resource requests = 1;
        optional Resource limits = 2;
    }
    message Container {
        optional string repository = 1;
        optional Resources resources = 2;
    }
    optional string name = 1;
    optional Container container = 2;
}

extend google.protobuf.MessageOptions {
    optional Service service = 2001;
}
