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

namespace Sockeye.Models
{
    public class Purchase : ICoreBizObjectModel
    {
        public long Id { get; set; }
        public uint Concurrency { get; set; }
        [Required]
        public long CustomerId { get; set; }
        [NotMapped]
        public string CustomerViz { get; set; }
        [Required]
        public long VendorId { get; set; }
        [NotMapped]
        public string VendorViz { get; set; }
        [Required]
        public long ProductId { get; set; }
        [NotMapped]
        public string ProductViz { get; set; }
        public string SalesOrderNumber { get; set; }
        [Required]
        public DateTime PurchaseDate { get; set; }
        public DateTime? ExpireDate { get; set; }
        public DateTime? CancelDate { get; set; }
        public string CouponCode { get; set; }
        public string PurchaseNotes { get; set; }
        public bool RenewNoticeSent { get; set; } = false;
        public int Quantity { get; set; } = 1;
        public string VendorData { get; set; }
        public DateTime? ProcessedDate { get; set; }
        public string Wiki { get; set; }
        public string CustomFields { get; set; }
        public List<string> Tags { get; set; }
        //workaround for notification    
        [NotMapped, JsonIgnore]
        public string Name { get; set; }

        public Purchase()
        {
            Tags = new List<string>();
        }

        [NotMapped, JsonIgnore]
        public SockType SType { get => SockType.Purchase; }
    }//eoc
}//eons
