/*
 * Copyright (C) 2019 The Android Open Source Project
 *
 * 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 = "proto2";

package android.os.statsd;
option java_package = "com.android.os";
option java_multiple_files = true;
option java_outer_classname = "ActiveConfigProto";

message ActiveEventActivation {
    optional int32 atom_matcher_index = 1;

    // Time left in activation. When this proto is loaded after device boot,
    // the activation should be set to active for this duration.
    // This field will only be set when the state is ACTIVE
    optional int64 remaining_ttl_nanos = 2;

    enum State {
        UNNKNOWN = 0;
        // This metric should activate for remaining_ttl_nanos when we load the activations.
        ACTIVE = 1;
        // When we load the activations, this metric should activate on next boot for the tll
        // specified in the config.
        ACTIVATE_ON_BOOT = 2;
    }
    optional State state = 3;
}

message ActiveMetric {
    optional int64 id = 1;
    repeated ActiveEventActivation activation = 2;
}

message ActiveConfig {
    optional int64 id = 1;
    optional int32 uid = 2;
    repeated ActiveMetric metric = 3;
}

// all configs and their metrics on device.
message ActiveConfigList {
    repeated ActiveConfig config = 1;
}
