//
// Copyright 2018 - present the original author or 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";

option go_package = "github.com/opencord/voltha-go/protos/omci";

package alarm;

import "meta.proto";


message AlarmAttributeData {
    string name        = 1 [(voltha.access) = READ_ONLY];
    string value       = 2;
}

message AlarmInstanceData {
    uint32 instance_id      = 1 [(voltha.access) = READ_ONLY];
    string created          = 2;
    string modified         = 3;

    repeated AlarmAttributeData attributes = 4
    [(voltha.child_node) = {key: "name"}];
}

message AlarmClassData {
    uint32 class_id         = 1 [(voltha.access) = READ_ONLY];

    repeated AlarmInstanceData instances= 2
    [(voltha.child_node) = {key: "instance_id"}];
}

message AlarmManagedEntity {
    uint32 class_id  = 1 [(voltha.access) = READ_ONLY];
    string name      = 2 [(voltha.access) = READ_ONLY];
}

message AlarmMessageType {
    uint32 message_type = 1 [(voltha.access) = READ_ONLY];
}

message AlarmDeviceData {
    string device_id             = 1 [(voltha.access) = READ_ONLY];
    string created               = 2;
    uint32 last_alarm_sequence   = 3;
    string last_sync_time        = 4;
    uint32 version               = 5;


    repeated AlarmClassData classes = 6
    [(voltha.child_node) = {key: "class_id"}];

    repeated AlarmManagedEntity managed_entities = 7;
    repeated AlarmMessageType message_types = 8;
}

message AlarmOpenOmciEventType {
    enum OpenOmciEventType {
        state_change = 0; // A state machine has transitioned to a new state
    }
}

message AlarmOpenOmciEvent {
    AlarmOpenOmciEventType.OpenOmciEventType type = 1;

    string data = 2; // associated data, in json format
}
