using EVCB_OCPP.Packet20.DataTypes.EnumTypes;
using Newtonsoft.Json;
using Newtonsoft.Json.Converters;
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace EVCB_OCPP.Packet20.DataTypes
{
    public class SetMonitoringDataType
    {
        /// <summary>
        /// An id SHALL only be given to replace an existing
        ///  monitor.The Charging Station handles the generation of
        /// id’s for new monitors.
        /// </summary>
        public int? Id { set; get; }

        /// <summary>
        /// Value for threshold or delta monitoring. For
        ///Periodic or PeriodicClockAligned this is the interval in
        ///seconds.
        /// </summary>
        [Required]
        public decimal Value { set; get; }

        /// <summary>
        /// The type of this monitor, e.g. a threshold, delta
       /// or periodic monitor.
        /// </summary>
        [Required]
        [JsonConverter(typeof(StringEnumConverter))]
        public MonitorEnumType Type { set; get; }

        /// <summary>
        /// The severity that will be assigned to an event
        ///  that is triggered by this monitor.The severity range is 0-9,
        ///with 0 as the highest and 9 as the lowest severity level.
        ///The severity levels have the following meaning:
        ///0-Danger
        ///Indicates lives are potentially in danger.Urgent attention
        ///is needed and action should be taken immediately.
        ///1-Hardware Failure
        ///Indicates that the Charging Station is unable to continue
        ///regular operations due to Hardware issues. Action is
        ///required.
        ///2-System Failure
        ///Indicates that the Charging Station is unable to continue
        ///regular operations due to software or minor hardware
        ///issues.Action is required.
        ///3-Critical
        ///Indicates a critical error.Action is required.
        ///4-Error
        ///Indicates a non-urgent error. Action is required.
        ///5-Alert
        ///Indicates an alert event. Default severity for any type of
        ///monitoring event.
        ///6-Warning
        ///Indicates a warning event. Action may be required.
        ///7-Notice
        ///Indicates an unusual event. No immediate action is
        ///required.
        ///8-Informational
        ///Indicates a regular operational event. May be used for
        ///reporting, measuring throughput, etc. No action is
        ///required.
        ///9-Debug
        ///Indicates information useful to developers for debugging,
        ///not useful during operations.
        /// </summary>
        [Required]
        public int Serverity { set; get; }

        /// <summary>
        /// Monitor only active when a transaction is
       /// ongoing on a component relevant to this transaction.
        ///Default = false.
        /// </summary>
        public bool? Transaction { set; get; }

        /// <summary>
        /// Component for which monitor is set.
        ///variable VariableType
        /// </summary>
        [Required]
        public ComponentType Component { set; get; }

        /// <summary>
        /// Variable for which monitor is set.
        /// </summary>
        [Required]
        public VariableType Variable { set; get; }

    }
}
