using System.Collections.Generic;
using Sockeye.Biz;
namespace Sockeye.DataList
{
    internal class CustomerNotificationDeliveryLogDataList : DataListProcessingBase
    {
        public CustomerNotificationDeliveryLogDataList(long translationId)
        {
            DefaultListAType = SockType.OpsNotificationSettings;
            SQLFrom = "from acustomernotifydeliverylog left join acustomernotifysubscription on acustomernotifysubscription.id = acustomernotifydeliverylog.customernotifysubscriptionid";
            var RoleSet = BizRoles.GetRoleSet(DefaultListAType);
            AllowedRoles = RoleSet.ReadFullRecord | RoleSet.Change;
            DefaultColumns = new List<string>() { "CustomerNotifySubscription", "Processed", "NotifyEventType", "CustomerTags", "Failed", "Errors" };
            DefaultSortBy = new Dictionary<string, string>() { { "Processed", "-" } };
            FieldDefinitions = new List<DataListFieldDefinition>();

            FieldDefinitions.Add(new DataListFieldDefinition
            {
                TKey = "CustomerNotifySubscription",
                FieldKey = "CustomerNotifySubscription",
                SockType = (int)SockType.CustomerNotifySubscription,
                UiFieldDataType = (int)UiFieldDataType.Text,
                SqlIdColumnName = "acustomernotifysubscription.id",
                SqlValueColumnName = "acustomernotifysubscription.id",
                IsRowId = false
            });

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

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

            FieldDefinitions.Add(new DataListFieldDefinition
            {
                TKey = "CustomerTags",
                FieldKey = "CustomerTags",
                UiFieldDataType = (int)UiFieldDataType.Tags,
                SqlValueColumnName = "acustomernotifysubscription.customertags"
            });

           

            FieldDefinitions.Add(new DataListFieldDefinition
            {
                TKey = "Failed",
                FieldKey = "Failed",
                UiFieldDataType = (int)UiFieldDataType.Bool,
                SqlValueColumnName = "acustomernotifydeliverylog.fail"
            });

            FieldDefinitions.Add(new DataListFieldDefinition
            {
                TKey = "Errors",
                FieldKey = "Errors",
                UiFieldDataType = (int)UiFieldDataType.Text,
                SqlValueColumnName = "acustomernotifydeliverylog.error"
            });



        }
    }//eoc
}//eons