// Copyright 2018 Istio Authors
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//     http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

syntax = "proto3";

package istio.mixer.adapter.model.v1beta1;

option go_package="istio.io/api/mixer/adapter/model/v1beta1";

import "google/protobuf/duration.proto";
import "google/protobuf/timestamp.proto";

// Value is used inside templates for fields that have dynamic types. The actual datatype
// of the field depends on the datatype of the expression used in the operator configuration.
message Value {
    oneof value {
        // Used for values of type STRING
        string string_value = 1;

        // Used for values of type INT64
        int64 int64_value = 2;

        // Used for values of type DOUBLE
        double double_value = 3;

        // Used for values of type BOOL
        bool bool_value = 4;

        // Used for values of type IPAddress
        IPAddress ip_address_value = 5;

        // Used for values of type TIMESTAMP
        TimeStamp timestamp_value = 6;

        // Used for values of type DURATION
        Duration duration_value = 7;

        // Used for values of type EmailAddress
        EmailAddress email_address_value = 8;

        // Used for values of type DNSName
        DNSName dns_name_value = 9;

        // Used for values of type Uri
        Uri uri_value = 10;
    }
}

// IPAddress is used inside templates for fields that are of ValueType "IP_ADDRESS"
message IPAddress {
    // IPAddress encoded as bytes.
    bytes value = 1;
}

// Duration is used inside templates for fields that are of ValueType "DURATION"
message Duration {
    // Duration encoded as google.protobuf.Duration.
    google.protobuf.Duration value = 1;
}

// TimeStamp is used inside templates for fields that are of ValueType "TIMESTAMP"
message TimeStamp {
    // TimeStamp encoded as google.protobuf.Timestamp.
    google.protobuf.Timestamp value = 1;
}

// DNSName is used inside templates for fields that are of ValueType "DNS_NAME"
message DNSName {
    // DNSName encoded as string.
    string value = 1;
}

// EmailAddress is used inside templates for fields that are of ValueType "EMAIL_ADDRESS"
// DO NOT USE !! Under Development
message EmailAddress {
    // EmailAddress encoded as string.
    string value = 1;
}

// Uri is used inside templates for fields that are of ValueType "URI"
// DO NOT USE ! Under Development
message Uri {
    // Uri encoded as string.
    string value = 1;
}
