//
// Copyright 2020 The Feast 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
//
//     https://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 feast.core;

option go_package = "github.com/feast-dev/feast/go/protos/feast/core";
option java_outer_classname = "StreamFeatureViewProto";
option java_package = "feast.proto.core";


import "google/protobuf/duration.proto";
import "feast/core/OnDemandFeatureView.proto";
import "feast/core/FeatureView.proto";
import "feast/core/Feature.proto";
import "feast/core/DataSource.proto";
import "feast/core/Aggregation.proto";

message StreamFeatureView {
    // User-specified specifications of this feature view.
    StreamFeatureViewSpec spec = 1;
    FeatureViewMeta meta = 2;
}

// Next available id: 17
message StreamFeatureViewSpec {
    // Name of the feature view. Must be unique. Not updated.
    string name = 1;

    // Name of Feast project that this feature view belongs to.
    string project = 2;

    // List of names of entities associated with this feature view.
    repeated string entities = 3;

    // List of specifications for each feature defined as part of this feature view.
    repeated FeatureSpecV2 features = 4;

    // List of specifications for each entity defined as part of this feature view.
    repeated FeatureSpecV2 entity_columns = 5;

    // Description of the feature view.
    string description = 6;

    // User defined metadata
    map<string,string> tags = 7;

    // Owner of the feature view.
    string owner = 8;

    // Features in this feature view can only be retrieved from online serving
    // younger than ttl. Ttl is measured as the duration of time between
    // the feature's event timestamp and when the feature is retrieved
    // Feature values outside ttl will be returned as unset values and indicated to end user
    google.protobuf.Duration ttl = 9;

    // Batch/Offline DataSource where this view can retrieve offline feature data.
    DataSource batch_source = 10;
    // Streaming DataSource from where this view can consume "online" feature data.
    DataSource stream_source = 11;

    // Whether these features should be served online or not
    bool online = 12;

    // Serialized function that is encoded in the streamfeatureview
    UserDefinedFunction user_defined_function = 13;

    // Mode of execution
    string mode = 14;

    // Aggregation definitions
    repeated Aggregation aggregations = 15;

    // Timestamp field for aggregation
    string timestamp_field = 16;
}

