using Edge.Core.UniversalApi;
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Text;

namespace Edge.Core.Database.Models
{
    public class GenericData
    {
        /// <summary>
        /// database auto increase unique id, DO NOT map on it.
        /// </summary>
        [Key]
        public int Id { get; set; }

        [Required]
        public string Owner { get; set; }

        public string Type { get; set; }

        public string State { get; set; }

        public string Description { get; set; }

        /// <summary>
        /// Used to store serialized custom object.
        /// </summary>
        public string ComplexData { get; set; }


        public DateTime? CreatedTimeStamp { get; set; }
        public DateTime? ModifiedTimeStamp { get; set; }

        public int? IntProperty0 { get; set; }
        public int? IntProperty1 { get; set; }
        public int? IntProperty2 { get; set; }
        public int? IntProperty3 { get; set; }
        public int? IntProperty4 { get; set; }
        public int? IntProperty5 { get; set; }
        public int? IntProperty6 { get; set; }
        public int? IntProperty7 { get; set; }
        public int? IntProperty8 { get; set; }
        public int? IntProperty9 { get; set; }

        public double? DoubleProperty0 { get; set; }
        public double? DoubleProperty1 { get; set; }
        public double? DoubleProperty2 { get; set; }
        public double? DoubleProperty3 { get; set; }
        public double? DoubleProperty4 { get; set; }
        public double? DoubleProperty5 { get; set; }
        public double? DoubleProperty6 { get; set; }
        public double? DoubleProperty7 { get; set; }
        public double? DoubleProperty8 { get; set; }
        public double? DoubleProperty9 { get; set; }

        public string StrProperty0 { get; set; }
        public string StrProperty1 { get; set; }
        public string StrProperty2 { get; set; }
        public string StrProperty3 { get; set; }
        public string StrProperty4 { get; set; }
        public string StrProperty5 { get; set; }
        public string StrProperty6 { get; set; }
        public string StrProperty7 { get; set; }
        public string StrProperty8 { get; set; }
        public string StrProperty9 { get; set; }

        public DateTime? TimeStampProperty0 { get; set; }
        public DateTime? TimeStampProperty1 { get; set; }
        public DateTime? TimeStampProperty2 { get; set; }
        public DateTime? TimeStampProperty3 { get; set; }
        public DateTime? TimeStampProperty4 { get; set; }
    }

    public class GenericAlarmDbModel
    {
        [Key]
        public int Id { get; set; }
        public string ProcessorEndpointFullTypeStr { get; set; }
        public string OriginatorDisplayName { get; set; }
        /// <summary>
        /// Gets or sets the alarm message title.
        ///     please keep this shorter for better user exp in UI, and fill with multiple languages string, like: lang-en-us:helloWorldlang-zh-ch:你好世界.
        /// </summary>
        public string Title { get; set; }

        /// <summary>
        /// Gets or sets the alarm message detail.
        ///     please fill with multiple languages string, like: lang-en-us:helloWorldlang-zh-ch:你好世界.
        /// </summary>
        public string Detail { get; set; }

        /// <summary>
        /// Abstract description for a serial of alarms that could help to group alarms.
        ///     this is mostly used by UI app that providing a group box to group similar alarms.
        /// </summary>
        public string Category { get; set; }

        /// <summary>
        /// Abstract description for a serial of alarms that could help to further group alarms besides Category.
        ///     this is mostly used by UI app that providing a group box to group similar alarms.
        /// </summary>
        public string SubCategory { get; set; }

        /// <summary>
        /// Used to store specific business data that the caller may use it when retrieve the historical alarms. 
        /// </summary>
        public string HiddenData { get; set; }
        /// <summary>
        /// could be anything that recognized by front end(mostly the Web html/javascript).
        /// </summary>
        public string Action { get; set; }
        public GenericAlarmSeverity Severity { get; set; }

        /// <summary>
        /// alarms with same identity from a processor will be treat as the same alarm, thus only the earliest fired single alarm will be persist, following alarms will be ignored for persist.
        /// leave this value null or empty will treat a new one, thus it'll be persist.
        /// </summary>
        //public string Identity { get; set; }
        public DateTime OpeningTimestamp { get; set; }

        public string AckedReason { get; set; }
        public DateTime? AckedTimestamp { get; set; }

        public string ClosedReason { get; set; }
        public DateTime? ClosedTimestamp { get; set; }
    }
}
