using System;
using System.Collections.Generic;
using AyaNova.Biz;
using System.ComponentModel.DataAnnotations;
using Newtonsoft.Json;

namespace AyaNova.Models
{
    //NOTE: Any non required field (nullable in DB) sb nullable here, i.e. decimal? not decimal, 
    //otherwise the server will call it an invalid record if the field isn't sent from client

    public class Notification
    {
        public long Id { get; set; }
        public uint Concurrency { get; set; }

        [Required]
        public long UserId { get; set; }
        [Required]
        public DateTime Created { get; set; }
        public AyaType? AyaType { get; set; }
        public long? ObjectId { get; set; }
        [Required]
        public string Name {get;set;}//object name or closest equivalent for display
        [Required]
        public NotifyEventType EventType { get; set; }
        [Required]
        public long NotifySubscriptionId { get; set; }
        public string Message { get; set; }
        [Required]
        public bool Fetched { get; set; }

        public Notification()
        {
            Created = DateTime.UtcNow;
            Fetched = false;
            Name=string.Empty;
        }

        //linked entity
        [JsonIgnore]
        public NotifySubscription NotifySubscription { get; set; }

    }//eoc

}//eons
