using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using Newtonsoft.Json;
namespace Sockeye.Models
{

    public class GlobalBizSettings
    {

        //This is the replacement for most of the Global object settings in v7 which has been subdivided further in v8 into backup / ops / notification and this general biz
        //this object is only interested in Business object related settings and configuration specifically


        public long Id { get; set; }//this is always 1 as there is only ever one single global biz object
        public uint Concurrency { get; set; }

        //Global settings
        //#############  NOTE: OTHER AREAS THAT MUST MATCH CHANGES HERE ARE:
        //GlobalBizSettingsController::GetClientGlobalBizSettings
        //ServerGlobalBizSettings

        //Picklist and other searches override the normal case insensitive value
        //this is precautionarily added for non latinate languages where it could be an issue
        public bool FilterCaseSensitive { get; set; }



        //ADDRESS / CONTACT INFO reporting etc
        public string WebAddress { get; set; }
        public string EmailAddress { get; set; }
        public string Phone1 { get; set; }
        public string Phone2 { get; set; }
        //POSTAL ADDRESS
        public string PostAddress { get; set; }
        public string PostCity { get; set; }
        public string PostRegion { get; set; }
        public string PostCountry { get; set; }
        public string PostCode { get; set; }

        //PHYSICAL ADDRESS
        public string Address { get; set; }
        public string City { get; set; }
        public string Region { get; set; }
        public string Country { get; set; }
        public string AddressPostal { get; set; }
        public decimal? Latitude { get; set; }
        public decimal? Longitude { get; set; }


        //CUSTOMER ACCESS FEATURES AND SETTINGS     
        public bool CustomerAllowUserSettings { get; set; }
        public List<string> CustomerAllowUserSettingsInTags { get; set; } = new List<string>();

        //SOCKEY EMAIL TEMPLATES 
        public string V7NewKey { get; set; }
        public string V7AddOnKey { get; set; }
        public string V7TemporaryTrial { get; set; }
        public string RavenNewKeyAvailable { get; set; }
        public string ValidateEmail { get; set; }
        public string RavenTrialApproved { get; set; }
        public string RavenTrialRejected { get; set; }




        public List<string> AllTags()
        {
            var t = new List<string>();

            t.AddRange(this.CustomerAllowUserSettingsInTags);
            return t;
        }

        public GlobalBizSettings()
        {
            Id = 1;//always 1  
            FilterCaseSensitive = false;
            #region Default message templates
            V7NewKey = @"Thank you for your purchase and welcome to the   
world-wide community of AyaNova users!   
   
Below is your activation key instructions for entry into the latest trial version
of AyaNova 7 that you previously downloaded from our website,   
installed and tested for suitability.   
 
Be sure to review and implement the backup procedures for AyaNova  
as outlined in the AyaNova online Help document from http://www.ayanova.com/onlinehelp.htm   
 
Reminder: no physical product will be shipped to you, this license key  
fulfills your order in full.   
   
PURCHASING ADDITIONAL LICENSES   
When purchasing additional licenses in future be sure to use the same registration name
and registered email address used when you purchased this key.  
  
Additional AyaNova licenses can be purchased via the link at   
http://www.ayanova.com/purchase.htm   
   
   
HELP AND SUPPORT RESOURCES   
 
ONLINE: 
AyaNova web site:   
http://www.ayanova.com   
 
Answers to frequently asked questions:   
http://www.ayanova.com/faqAnswers.htm   
 
Technical support forum:   
http://forum.ayanova.com   
 
Latest AyaNova version update information:  
Downloads and help documentation: 
http://www.ayanova.com/download.htm 
http://www.ayanova.com/onlinehelp.htm

PURCHASING ADDITIONAL LICENSES   
When purchasing additional license subscriptions in future do use the same registration name
and registered email address used when you purchased your original licenses to ensure fastest processing.

{LicenseDescription} 

HOW TO INSTALL YOUR LICENSE KEY

1. Ensure no other users are running AyaNova

2. Log in as the AyaNova Administrator
(default login is manager with password letmein if not yet changed).

3. Select Help->License from the main menu to open the license key form.

4. Select the menu option Fetch license and in the form that opens, copy and paste (preferable) or enter manually your Fetch address and Fetch code exactly as it appears above in 'License Details' section of this message.
(If you do not see the 'Fetch license' menu option you need to upgrade to the latest version of AyaNova first)

5. Click on the accept button, AyaNova will fetch the license key from our server and install it automatically";


            V7AddOnKey = @"Thank you for your continued support!

This license key when applied, replaces your previous key which is no longer required.

{LicenseDescription}

HOW TO INSTALL YOUR LICENSE KEY

1. Be sure you are running the latest version before proceeding:
https://www.ayanova.com/changeloglatest.htm

2. Ensure no other users are running AyaNova

3. Log in as the AyaNova Administrator
(default login is manager with password letmein if not yet changed).

4. Select Help->License from the main menu to open the license key form.

5. Select the menu option Fetch license and in the form that opens, copy and paste (preferable) or enter manually your Fetch address and Fetch code exactly as it appears above in 'License Details' section of this message.
(If you do not see the 'Fetch license' menu option you need to upgrade to the latest version of AyaNova first)

6. Click on the accept button, AyaNova will fetch the license key from our server and install it automatically";


            V7TemporaryTrial = @"Thank you for evaluating AyaNova 7 and its optional add-ons. 
  
Below are instructions for license entry into the 
latest trial version of AyaNova that you previously downloaded from our website.  
    
HELP AND SUPPORT RESOURCES   

ONLINE:
AyaNova web site:  
http://www.ayanova.com  

Answers to frequently asked questions:   
http://www.ayanova.com/faqAnswers.htm  

Technical support forum:   
http://forum.ayanova.com  

Latest AyaNova version update information: 
Downloads and help documentation: 
http://www.ayanova.com/download.htm 
http://www.ayanova.com/onlinehelp.htm 

 
{LicenseDescription}


HOW TO INSTALL YOUR LICENSE KEY

1. Ensure no other users are running AyaNova

2. Log in as the AyaNova Administrator
(default login is manager with password letmein if not yet changed).

3. Select Help->License from the main menu to open the license key form.

4. Select the menu option Fetch license and in the form that opens,  copy  and paste (preferable) or enter manually your Fetch address and Fetch code exactly as it appears above in License Details section.
(If you do not see the 'Fetch license' menu option you need to upgrade to the latest version of AyaNova first)

5. Click on the accept button, AyaNova will fetch the license key from our server and install it automatically";


            RavenNewKeyAvailable = @"A new AyaNova license key is available.\nAyaNova will automatically fetch it within 24 hours or you can force it to fetch immediately from the License page in AyaNova now.\n---\n{newLicense}";


            ValidateEmail = @"Please verify your email address by clicking the link below or copy and pasting into a browser\r\n{verifyUrl}\r\nOnce your email is verified the request will be processed manually during business hours.\r\n(If you did not request this you can ignore this message)";


            RavenTrialApproved = @"Your trial license request has been approved.\r\nThe license will be automatically installed shortly or you can fetch it now in the License form menu.";


            RavenTrialRejected = @"Your trial license request was not approved.\r\n{reason}";

            #endregion default message templates


        }
    }

    //Used internally and at client end as extended rights atop roles system in relation only to Contact (customer type users)
    public record CustomerRightsRecord(bool UserSettings, long EntityId, bool EntityActive);
}
/*
CREATE TABLE [dbo].[AGLOBAL](
	[ACREATED] [datetime] NULL,
	[AMODIFIED] [datetime] NULL,
	[ACREATOR] [uniqueidentifier] NULL,
	[AMODIFIER] [uniqueidentifier] NULL,
	[ATAXPARTPURCHASEID] [uniqueidentifier] NULL,
	[ATAXPARTSALEID] [uniqueidentifier] NULL,
	[ATAXRATESALEID] [uniqueidentifier] NULL,
	[AALLOWSCHEDULECONFLICTS] [bit] NOT NULL,
	[ALANGUAGE] [nvarchar](255) NULL,
	[AUSEREGIONS] [bit] NOT NULL,
	[AWORKORDERCLOSEDSTATUS] [uniqueidentifier] NULL,
	[AWORKORDERSUMMARYTEMPLATE] [nvarchar](500) NOT NULL,
	[AUSEINVENTORY] [bit] NOT NULL,
	[AUNITNAMEFORMAT] [smallint] NULL,
	[ASCHEDULEABLEUSERNAMEFORMAT] [smallint] NULL,
	[ACJKINDEX] [bit] NOT NULL,
	[APARTFORMAT] [smallint] NULL,
	[AWORKORDERCLOSEBYAGE] [int] NOT NULL,
	[AUSENOTIFICATION] [bit] NOT NULL,
	[ANOTIFYSMTPHOST] [nvarchar](255) NULL,
	[ANOTIFYSMTPACCOUNT] [nvarchar](255) NULL,
	[ANOTIFYSMTPPASSWORD] [nvarchar](255) NULL,
	[ANOTIFYSMTPFROM] [nvarchar](255) NULL,
	[ACOORDINATESTYLE] [smallint] NULL,
	[ADEFAULTLATITUDE] [smallint] NULL,
	[ADEFAULTLONGITUDE] [smallint] NULL,
	[ADEFAULTSERVICETEMPLATEID] [uniqueidentifier] NULL,
	[AMAXFILESIZEMB] [int] NULL,
	[ALABORSCHEDUSERDFLTTIMESPAN] [int] NOT NULL,
	[ATRAVELDFLTTIMESPAN] [int] NOT NULL,
	[ANOTIFYENCRYPTION] [nvarchar](255) NULL,
	[ASMTPRETRY] [bit] NOT NULL,
	[AFORMCUSTOM] [ntext] NULL,
	[ASIGNATURETITLE] [ntext] NULL,
	[ASIGNATUREHEADER] [ntext] NULL,
	[ASIGNATUREFOOTER] [ntext] NULL,
	[ASCHEDUSERNONTODAYSTARTTIME] [datetime] NULL,
	[AMAINGRIDAUTOREFRESH] [bit] NOT NULL
*/