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

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 TrialLicenseRequest : ICoreBizObjectModel
    {
        public long Id { get; set; }
        public uint Concurrency { get; set; }
        [Required]
        public string DbId { get; set; }
        [Required]
        public string CompanyName { get; set; }
        [Required]
        public string ContactName { get; set; }
        [Required]
        public string Email { get; set; }
        [Required]
        public string EmailConfirmCode { get; set; }
        public bool EmailValidated { get; set; } = false;
        public DateTime Requested { get; set; }
        public DateTime? Processed { get; set; }
        public TrialRequestStatus Status { get; set; } = TrialRequestStatus.New;
        public string RejectReason { get; set; }
        public long? LicenseId { get; set; }
        [Required]
        public ProductGroup PGroup { get; set; }     
        public List<string> Tags { get; set; }

        //workaround for notification    
        [NotMapped, JsonIgnore]
        public string Name { get; set; }


        public TrialLicenseRequest()
        {

        }

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

    }//eoc

}//eons
/*
  "CREATE TABLE atriallicenserequest (id BIGINT GENERATED ALWAYS AS IDENTITY PRIMARY KEY, dbid TEXT NOT NULL, companyname TEXT NOT NULL, "
+ "contactname TEXT NOT NULL, email TEXT NOT NULL, emailconfirmcode TEXT NOT NULL, emailvalidated BOOL DEFAULT false, "
+ "requested TIMESTAMPTZ, processed TIMESTAMPTZ, status INTEGER NOT NULL DEFAULT 0, rejectreason TEXT, key TEXT, "
+ "fetched TIMESTAMPTZ, perpetual BOOL DEFAULT false NOT NULL )"
*/