syntax = "proto3";

package tests.harness.cases;
option go_package = "github.com/envoyproxy/protoc-gen-validate/tests/harness/cases/go;cases";
import "validate/validate.proto";

message TestOneOfMsg {
    bool val = 1 [(validate.rules).bool.const = true];
}

message OneOfNone {
    oneof o {
        string       x = 1;
        int32        y = 2;
    }
}

message OneOf {
    oneof o {
        string       x = 1 [(validate.rules).string.prefix = "foo"];
        int32        y = 2 [(validate.rules).int32.gt = 0];
        TestOneOfMsg z = 3;
    }
}

message OneOfRequired {
    oneof o {
        option (validate.required) = true;

        string       x = 1;
        int32        y = 2;
        int32        name_with_underscores = 3;
        int32        under_and_1_number = 4;
    }
}

message OneOfIgnoreEmpty {
    oneof o {
        string       x = 1 [(validate.rules).string = {ignore_empty: true, min_len: 3, max_len: 5}];
        bytes        y = 2 [(validate.rules).bytes = {ignore_empty: true, min_len: 3, max_len: 5}];
        int32        z = 3 [(validate.rules).int32 = {lte: 128, gte: 256, ignore_empty: true}];
    }
}
