using Sockeye.Util;
using Sockeye.Models;


namespace Sockeye.Biz
{


    internal static class BizObjectFactory
    {


        //Returns the biz object class that corresponds to the type presented
        //Used by SEARCH, REPORTING and objects with JOBS
        internal static BizObject GetBizObject(SockType sockType,
                                               AyContext ct,
                                               long userId,
                                               AuthorizationRoles roles,
                                               long translationId = 0)
        {
            if (translationId == 0)
                translationId = ServerBootConfig.SOCKEYE_DEFAULT_TRANSLATION_ID;

            switch (sockType)
            {
                //CoreBizObject add here
                case SockType.ServerJob:
                    return new JobOperationsBiz(ct, userId, roles);

                case SockType.Translation:
                    return new TranslationBiz(ct, userId, translationId, roles);
                case SockType.DataListSavedFilter:
                    return new DataListSavedFilterBiz(ct, userId, translationId, roles);
                case SockType.FormCustom:
                    return new FormCustomBiz(ct, userId, translationId, roles);
                case SockType.FileAttachment:
                    return new AttachmentBiz(ct, userId, roles);
                case SockType.Customer:
                    return new CustomerBiz(ct, userId, translationId, roles);
                case SockType.CustomerNote:
                    return new CustomerNoteBiz(ct, userId, translationId, roles);
                case SockType.User:
                    return new UserBiz(ct, userId, translationId, roles);
                case SockType.Memo:
                    return new MemoBiz(ct, userId, translationId, roles);
                case SockType.HeadOffice:
                    return new HeadOfficeBiz(ct, userId, translationId, roles);
                case SockType.Reminder:
                    return new ReminderBiz(ct, userId, translationId, roles);
                case SockType.Review:
                    return new ReviewBiz(ct, userId, translationId, roles);
                case SockType.CustomerNotifySubscription:
                    return new CustomerNotifySubscriptionBiz(ct, userId, translationId, roles);
                case SockType.Report:
                    return new ReportBiz(ct, userId, translationId, roles);
                case SockType.License:
                    return new LicenseBiz(ct, userId, translationId, roles);
                case SockType.TrialLicenseRequest:
                    return new TrialLicenseRequestBiz(ct, userId, translationId, roles);
                case SockType.SubscriptionServer:
                    return new SubscriptionServerBiz(ct, userId, translationId, roles);
                case SockType.Purchase:
                    return new PurchaseBiz(ct, userId, translationId, roles);
                case SockType.VendorNotification:
                    return new VendorNotificationBiz(ct, userId, translationId, roles);
                case SockType.Product:
                    return new ProductBiz(ct, userId, translationId, roles);
                case SockType.GZCase:
                    return new GZCaseBiz(ct, userId, translationId, roles);

                default:
                    throw new System.NotSupportedException($"Sockeye.BLL.BizObjectFactory::GetBizObject type {sockType.ToString()} is not supported");
            }


        }


        /////////////////////////////////////////////////////////////////////

    }//eoc


}//eons

