/* SPDX-License-Identifier: BSD-3-Clause */
/*
 * Copyright 2017 Raritan Inc. All rights reserved.
 */

#ifndef __PDUMODEL_OCP_TRIP_SENSOR_IDL__
#define __PDUMODEL_OCP_TRIP_SENSOR_IDL__

#include <Outlet.idl>
#include <StateSensor.idl>
#include <Waveform.idl>

/** PDU Model */
module pdumodel {

    /** Overcurrent protector trip sensor interface */
    interface OverCurrentProtectorTripSensor_1_1_13 extends sensors.StateSensor_4_0_7 {
        structure TripEventInformation {
            Outlet_3_0_3 cause; ///< Outlet that is most likely to have caused the OCP to trip.
            time timestamp;     ///< Timestamp of trip event
            double current;     ///< Current flow in outlet causing the event at trip time.
                                ///< If current flow can not be determined, this value is sent as 0.
        };

        /** Event: Overcurrent protector trip state has changed */
        valueobject TripStateChangedEvent extends sensors.StateSensor_4_0_7.StateChangedEvent {
            Outlet_3_0_3 tripCause; ///< Outlet that is most likely to have caused the OCP to trip.
                                    ///< Deprecated, use the tripInformation field instead.
            TripEventInformation tripInformation; ///< Information about the event that caused a trip event.
        };

        /**
         * Get the outlet that is most likely to have caused the last OCP trip.
         *
         * @return The outlet that most likely caused the OCP to trip. If either
         *         the OCP is not currently tripped or no outlet can be determined
         *         to have caused the trip, null is returned.
         *
         * This method is deprecated, use {@link getTripEventInformation} instead.
         */
        [deprecated]
        Outlet_3_0_3 getTripCause();

        /**
         * Get information about the last trip event.
         *
         * @return Trip event information, or an empty structure if the OCP currently isn't tripped.
         */
        TripEventInformation getTripEventInformation();

        /**
         * Get the voltage and current waveform during the last OCP trip event.
         *
         * @return The waveform during OCP trip in case both
         *         - A potential trip cause outlet could be determined and
         *         - The device supports waveform reading
         *         If either condition is not met, an empty waveform is returned.
         */
        Waveform getTripWaveform();
    };

}

#endif
