﻿using Castle.Core.Logging;
using EspaceClient.FrontOffice.Infrastructure.Constant;
using EspaceClient.FrontOffice.Infrastructure.Services.Depots;
using EspaceClient.FrontOffice.Infrastructure.Services.Encryption;
using EspaceClient.FrontOffice.Infrastructure.Services.Translation;
using EspaceClient.FrontOffice.Web.ViewModels.Pages.Common;
using EspaceClient.FrontOffice.Web.ViewModels.Pages.Home;
using System.Collections.Generic;

namespace EspaceClient.FrontOffice.Web.ViewModels.ModelBuilders.Home
{
    public class HomeModelBuilder : IHomeModelBuilder
    {
        private readonly ITranslator _translationService;
        private readonly IDepotFactory _depotFactory;
        private readonly ILogger _logger;
        private readonly ICryptography _cryptography;

        public HomeModelBuilder(ILogger logger, IDepotFactory depotFactory, ITranslator translationService, ICryptography cryptography)
        {
            _logger = logger;
            _depotFactory = depotFactory;
            _translationService = translationService;
            _cryptography = cryptography;
        }

        public IEnumerable<OrganisationBlocBase> BuildPopupClient(Context context)
        {
            List<OrganisationBlocBase> Result = new List<OrganisationBlocBase>()
            {
                new OrganisationBlocManual()
                {
                    Bloc = new ViewModels.BlocViewModel()
                    {
                        Code = ViewNames.HomePopin.ToString(),
                    },
                    ViewPattern = "~/Views/Home/Blocs/{0}.cshtml",

                    ManualBlocName = ViewNames.HomePopin.ToString(),
                    Ordre = 2,
                    ZonePage=Zones.Center
                },
                
            };

            return Result;
        }

        public PopupClientViewModel BuildPopupClientBloc(Context context)
        {
            var detail = _depotFactory.ClientDepot.GetPopupClient(context.User.ID);

            return new PopupClientViewModel(context, _translationService)
            {
                Detail = detail
            };
        }

    }
}
