using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using Newtonsoft.Json;
using Sockeye.Biz;

namespace Sockeye.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 Memo : ICoreBizObjectModel
    {
        public long Id { get; set; }
        public uint Concurrency { get; set; }

        [Required]
        public string Name { get; set; }//"subject"
        public string Notes { get; set; }//"message"
        public string Wiki { get; set; }
        public string CustomFields { get; set; }
        public List<string> Tags { get; set; }


        public bool Viewed { get; set; }
        public bool Replied { get; set; }
        public long? FromId { get; set; }
        [NotMapped]
        public string FromViz { get; set; }
        public long? ToId { get; set; }
        [NotMapped]
        public string ToViz { get; set; }
        public DateTime Sent { get; set; }//redundant but displayed all over the place in the UI so properly redundant

        public Memo()
        {
            Tags = new List<string>();
            Sent = DateTime.UtcNow;
        }

        [NotMapped, JsonIgnore]
        public SockType SType { get => SockType.Memo; }

    }//eoc

}//eons
/*
CREATE TABLE [dbo].[AMEMO](
	[AID] [uniqueidentifier] NOT NULL,
	[ACREATED] [datetime] NULL,
	[AMODIFIED] [datetime] NULL,
	[ACREATOR] [uniqueidentifier] NULL,
	[AMODIFIER] [uniqueidentifier] NULL,
	[ASUBJECT] [nvarchar](255) NULL,
	[AMESSAGE] [ntext] NULL,
	[AFROMID] [uniqueidentifier] NOT NULL,
	[ATOID] [uniqueidentifier] NOT NULL,
	[AVIEWED] [bit] NOT NULL,
	[AREPLIED] [bit] NOT NULL,
*/