using System.Collections.Generic;
using System.Linq;
using Sockeye.Biz;
using Sockeye.Models;

namespace Sockeye.DataList
{
    internal class TrialLicenseRequestDataList : DataListProcessingBase
    {
        public TrialLicenseRequestDataList(long translationId)
        {
            DefaultListAType = SockType.TrialLicenseRequest;
            SQLFrom = @"FROM atriallicenserequest ";

            var RoleSet = BizRoles.GetRoleSet(DefaultListAType);
            AllowedRoles = RoleSet.ReadFullRecord | RoleSet.Change;
            DefaultColumns = new List<string>() { "id", "TrialLicenseRequestCompanyName", "TrialLicenseRequestRequested", "TrialLicenseRequestStatus", "licenseid", "ProductGroup" };
            DefaultSortBy = new Dictionary<string, string>() { { "id", "-" } };
            FieldDefinitions = new List<DataListFieldDefinition>();
 
            FieldDefinitions.Add(new DataListFieldDefinition
            {
                TKey = "ID",
                FieldKey = "id",
                SockType = (int)SockType.TrialLicenseRequest,
                UiFieldDataType = (int)UiFieldDataType.Integer,
                SqlIdColumnName = "atriallicenserequest.id",
                SqlValueColumnName = "atriallicenserequest.id",
                IsRowId = true
            });

            FieldDefinitions.Add(new DataListFieldDefinition
            {
                TKey = "DatabaseID",
                FieldKey = "DatabaseID",
                UiFieldDataType = (int)UiFieldDataType.Text,
                SqlValueColumnName = "atriallicenserequest.dbid"
            });


            FieldDefinitions.Add(new DataListFieldDefinition
            {
                TKey = "License",
                FieldKey = "licenseid",
                SockType = (int)SockType.License,
                UiFieldDataType = (int)UiFieldDataType.Integer,
                SqlIdColumnName = "atriallicenserequest.licenseid",
                SqlValueColumnName = "atriallicenserequest.licenseid"
            });

            FieldDefinitions.Add(new DataListFieldDefinition
            {
                TKey = "TrialLicenseRequestCompanyName",
                FieldKey = "TrialLicenseRequestCompanyName",
                UiFieldDataType = (int)UiFieldDataType.Text,
                SqlValueColumnName = "atriallicenserequest.companyname"
            });

            FieldDefinitions.Add(new DataListFieldDefinition
            {
                TKey = "TrialLicenseRequestContactName",
                FieldKey = "TrialLicenseRequestContactName",
                UiFieldDataType = (int)UiFieldDataType.Text,
                SqlValueColumnName = "atriallicenserequest.contactname"
            });

            FieldDefinitions.Add(new DataListFieldDefinition
            {
                TKey = "TrialLicenseRequestEmail",
                FieldKey = "TrialLicenseRequestEmail",
                UiFieldDataType = (int)UiFieldDataType.EmailAddress,
                SqlValueColumnName = "atriallicenserequest.email"
            });

            FieldDefinitions.Add(new DataListFieldDefinition
            {
                TKey = "TrialLicenseRequestRequested",
                FieldKey = "TrialLicenseRequestRequested",
                UiFieldDataType = (int)UiFieldDataType.DateTime,
                SqlValueColumnName = "atriallicenserequest.requested"
            });


            FieldDefinitions.Add(new DataListFieldDefinition
            {
                TKey = "TrialLicenseRequestProcessed",
                FieldKey = "TrialLicenseRequestProcessed",
                UiFieldDataType = (int)UiFieldDataType.DateTime,
                SqlValueColumnName = "atriallicenserequest.processed"
            });


            FieldDefinitions.Add(new DataListFieldDefinition
            {
                TKey = "TrialLicenseRequestStatus",
                FieldKey = "TrialLicenseRequestStatus",
                UiFieldDataType = (int)UiFieldDataType.Enum,
                EnumType = Sockeye.Util.StringUtil.TrimTypeName(typeof(TrialRequestStatus).ToString()),
                SqlValueColumnName = "atriallicenserequest.status"
            });


            FieldDefinitions.Add(new DataListFieldDefinition
            {
                TKey = "TrialLicenseRequestRejectReason",
                FieldKey = "TrialLicenseRequestRejectReason",
                UiFieldDataType = (int)UiFieldDataType.Text,
                SqlValueColumnName = "atriallicenserequest.rejectreason"
            });



           
          

            FieldDefinitions.Add(new DataListFieldDefinition
            {
                TKey = "ProductGroup",
                FieldKey = "ProductGroup",
                UiFieldDataType = (int)UiFieldDataType.Enum,
                EnumType = Sockeye.Util.StringUtil.TrimTypeName(typeof(ProductGroup).ToString()),
                SqlValueColumnName = "atriallicenserequest.pgroup"
            });



        }

    }//eoc
}//eons