using AutoMapper;
using Bp.Inventory.Domain.Batches;
using Bp.Sync.BackEnd.Infrastructure.Mappings;
using Bp.Sync.Domain.Elastics.FcBusinesses;
using Bp.Sync.Domain.Elastics.FcBusinesses.Bills;
using Bp.Sync.Domain.Elastics.FcBusinesses.Products;
using Bp.Sync.Domain.Elastics.FcBusinesses.UnitExchanges;
using Bp.Sync.Domain.Elastics.FcCustomers.Customers;
using Bp.Sync.Domain.Elastics.Finances;
using Bp.Sync.Domain.Elastics.Inventories;
using Bp.Sync.Domain.Elastics.Inventories.Accounts;
using Bp.Sync.Domain.Elastics.Inventories.Bills;
using Bp.Sync.Domain.Elastics.Inventories.Categories;
using Bp.Sync.Domain.Elastics.Inventories.Customers;
using Bp.Sync.Domain.Elastics.Inventories.Generals;
using Bp.Sync.Domain.Elastics.Inventories.Orders;
using Bp.Sync.Domain.Elastics.Inventories.Products;
using Bp.Sync.Domain.Elastics.Inventories.Suppliers;
using Bp.Sync.Domain.Elastics.Inventories.Units;
using Bp.Sync.Domain.Entities.FcBusinesses;
using Bp.Sync.Domain.Entities.FcCustomers.Customers;
using Bp.Sync.Domain.Entities.Finances;
using Bp.Sync.Domain.Entities.Inventories;
using Bp.Sync.Domain.Entities.Inventories.Accounts;
using Bp.Sync.Domain.Entities.Inventories.Bills;
using Bp.Sync.Domain.Entities.Inventories.Branches;
using Bp.Sync.Domain.Entities.Inventories.Categories;
using Bp.Sync.Domain.Entities.Inventories.Customers;
using Bp.Sync.Domain.Entities.Inventories.Generals;
using Bp.Sync.Domain.Entities.Inventories.Invoices;
using Bp.Sync.Domain.Entities.Inventories.Orders;
using Bp.Sync.Domain.Entities.Inventories.Products;
using Bp.Sync.Domain.Entities.Inventories.Reasons;
using Bp.Sync.Domain.Entities.Inventories.Suppliers;
using Bp.Sync.Domain.Entities.Inventories.Units;
using System.Collections.Generic;

namespace Vina.Search.Infrastructure.Mappings
{
    public static class MappingExtensions
    {
        public static MapperConfiguration MapperConfiguration;

        public static TDestination MapTo<TSource, TDestination>(this TSource source)
        {
            return AutoMapperConfig.Mapper.Map<TSource, TDestination>(source);
        }
        public static TDestination MapTo<TSource, TDestination>(this TSource source, TDestination destination)
        {
            return AutoMapperConfig.Mapper.Map(source, destination);
        }

        #region Transaction
        public static IEnumerable<TransactionElastic> ToTransactions(this IEnumerable<Transaction> model)
        {
            return model.MapTo<IEnumerable<Transaction>, IEnumerable<TransactionElastic>>();
        }
        #endregion

        #region Bill
        public static IEnumerable<BillElastic> ToBills(this IEnumerable<Bill> model)
        {
            return model.MapTo<IEnumerable<Bill>, IEnumerable<BillElastic>>();
        }
        public static IEnumerable<BatchElastic> ToBatches(this IEnumerable<Batch> model)
        {
            return model.MapTo<IEnumerable<Batch>, IEnumerable<BatchElastic>>();
        }
        public static IEnumerable<OutboundBillElastic> ToOutboundBills(this IEnumerable<OutboundBill> model)
        {
            return model.MapTo<IEnumerable<OutboundBill>, IEnumerable<OutboundBillElastic>>();
        }
        public static IEnumerable<InboundBillElastic> ToInboundBills(this IEnumerable<InboundBill> model)
        {
            return model.MapTo<IEnumerable<InboundBill>, IEnumerable<InboundBillElastic>>();
        }
        public static IEnumerable<InventoryBillElastic> ToInventoryBills(this IEnumerable<InventoryBill> model)
        {
            return model.MapTo<IEnumerable<InventoryBill>, IEnumerable<InventoryBillElastic>>();
        }
        public static IEnumerable<ProductBillElastic> ToProductBills(this IEnumerable<ProductBill> model)
        {
            return model.MapTo<IEnumerable<ProductBill>, IEnumerable<ProductBillElastic>>();
        }
        #endregion

        #region Invoice
        public static IEnumerable<InvoiceElastic> ToInvoices(this IEnumerable<Invoice> model)
        {
            return model.MapTo<IEnumerable<Invoice>, IEnumerable<InvoiceElastic>>();
        }
        #endregion

        #region Product
        public static IEnumerable<ProductElastic> ToProducts(this IEnumerable<Product> model)
        {
            return model.MapTo<IEnumerable<Product>, IEnumerable<ProductElastic>>();
        }
        #endregion

        #region Product
        public static IEnumerable<ProductInventoryElastic> ToProductInventorys(this IEnumerable<ProductInventory> model)
        {
            return model.MapTo<IEnumerable<ProductInventory>, IEnumerable<ProductInventoryElastic>>();
        }
        #endregion

        #region ProductInvoice
        public static IEnumerable<ProductInvoiceElastic> ToProductInvoices(this IEnumerable<ProductInvoice> model)
        {
            return model.MapTo<IEnumerable<ProductInvoice>, IEnumerable<ProductInvoiceElastic>>();
        }
        #endregion

        #region OrderElastic
        public static IEnumerable<OrderElastic> ToOrders(this IEnumerable<Order> model)
        {
            return model.MapTo<IEnumerable<Order>, IEnumerable<OrderElastic>>();
        }
        #endregion

        #region OrderElastic
        public static IEnumerable<ProductOrderElastic> ToProductOrders(this IEnumerable<ProductOrder> model)
        {
            return model.MapTo<IEnumerable<ProductOrder>, IEnumerable<ProductOrderElastic>>();
        }
        #endregion

        #region RetailBill
        public static IEnumerable<RetailBillElastic> ToRetailBills(this IEnumerable<RetailBill> model)
        {
            return model.MapTo<IEnumerable<RetailBill>, IEnumerable<RetailBillElastic>>();
        }
        #endregion

        #region Branch
        public static IEnumerable<BranchElastic> ToBranchs(this IEnumerable<Branch> model)
        {
            return model.MapTo<IEnumerable<Branch>, IEnumerable<BranchElastic>>();
        }
        #endregion

        #region ProductGroup
        public static IEnumerable<ProductGroupElastic> ToProductGroups(this IEnumerable<ProductGroup> model)
        {
            return model.MapTo<IEnumerable<ProductGroup>, IEnumerable<ProductGroupElastic>>();
        }
        public static IEnumerable<ProductTypeElastic> ToProductTypes(this IEnumerable<ProductType> model)
        {
            return model.MapTo<IEnumerable<ProductType>, IEnumerable<ProductTypeElastic>>();
        }
        #endregion

        #region Units
        public static IEnumerable<UnitElastic> ToUnits(this IEnumerable<Unit> model)
        {
            return model.MapTo<IEnumerable<Unit>, IEnumerable<UnitElastic>>();
        }
        public static IEnumerable<ReasonElastic> ToReasons(this IEnumerable<Reason> model)
        {
            return model.MapTo<IEnumerable<Reason>, IEnumerable<ReasonElastic>>();
        }
        public static IEnumerable<ProductUnitElastic> ToProductUnits(this IEnumerable<ProductUnit> model)
        {
            return model.MapTo<IEnumerable<ProductUnit>, IEnumerable<ProductUnitElastic>>();
        }

        public static IEnumerable<DebtElastic> ToDebts(this IEnumerable<Debt> model)
        {
            return model.MapTo<IEnumerable<Debt>, IEnumerable<DebtElastic>>();
        }
        public static IEnumerable<GeneralLedgerElastic> ToGeneralLedgers(this IEnumerable<GeneralLedger> model)
        {
            return model.MapTo<IEnumerable<GeneralLedger>, IEnumerable<GeneralLedgerElastic>>();
        }
        public static IEnumerable<AccountElastic> ToAccounts(this IEnumerable<Account> model)
        {
            return model.MapTo<IEnumerable<Account>, IEnumerable<AccountElastic>>();
        }
        #endregion

        #region Customer
        public static IEnumerable<CustomerElastic> ToCustomers(this IEnumerable<Customer> model)
        {
            return model.MapTo<IEnumerable<Customer>, IEnumerable<CustomerElastic>>();
        }
        public static IEnumerable<SupplierElastic> ToSuppliers(this IEnumerable<Supplier> model)
        {
            return model.MapTo<IEnumerable<Supplier>, IEnumerable<SupplierElastic>>();
        }
        #endregion

        #region Fc
        public static IEnumerable<RetailStatisticElastic> ToRetailStatistics(this IEnumerable<RetailStatistic> model)
        {
            return model.MapTo<IEnumerable<RetailStatistic>, IEnumerable<RetailStatisticElastic>>();
        }
        public static IEnumerable<InboundStatisticElastic> ToInboundStatistics(this IEnumerable<InboundStatistic> model)
        {
            return model.MapTo<IEnumerable<InboundStatistic>, IEnumerable<InboundStatisticElastic>>();
        }
        public static IEnumerable<OutboundStatisticElastic> ToOutboundStatistics(this IEnumerable<OutboundStatistic> model)
        {
            return model.MapTo<IEnumerable<OutboundStatistic>, IEnumerable<OutboundStatisticElastic>>();
        }
        public static IEnumerable<FcCustomerElastic> ToFcCustomers(this IEnumerable<FcCustomer> model)
        {
            return model.MapTo<IEnumerable<FcCustomer>, IEnumerable<FcCustomerElastic>>();
        }
        public static IEnumerable<FcInboundBillElastic> ToFcInboundBills(this IEnumerable<Bp.Sync.Domain.Entities.FcBusinesses.Bills.InboundBill> model)
        {
            return model.MapTo<IEnumerable<Bp.Sync.Domain.Entities.FcBusinesses.Bills.InboundBill>, IEnumerable<FcInboundBillElastic>>();
        }
        public static IEnumerable<FcOutboundBillElastic> ToFcOutboundBills(this IEnumerable<Bp.Sync.Domain.Entities.FcBusinesses.Bills.OutboundBill> model)
        {
            return model.MapTo<IEnumerable<Bp.Sync.Domain.Entities.FcBusinesses.Bills.OutboundBill>, IEnumerable<FcOutboundBillElastic>>();
        }
        public static IEnumerable<FcReceiptBillElastic> ToFcReceiptBills(this IEnumerable<Bp.Sync.Domain.Entities.FcBusinesses.Bills.ReceiptBill> model)
        {
            return model.MapTo<IEnumerable<Bp.Sync.Domain.Entities.FcBusinesses.Bills.ReceiptBill>, IEnumerable<FcReceiptBillElastic>>();
        }
        public static IEnumerable<FcProductStorageElastic> ToFcProductStorages(this IEnumerable<Bp.Sync.Domain.Entities.FcBusinesses.Products.ProductStorage> model)
        {
            return model.MapTo<IEnumerable<Bp.Sync.Domain.Entities.FcBusinesses.Products.ProductStorage>, IEnumerable<FcProductStorageElastic>>();
        }
        public static IEnumerable<FcProductShipmentElastic> ToFcProductShipments(this IEnumerable<Bp.Sync.Domain.Entities.FcBusinesses.Products.ProductShipment> model)
        {
            return model.MapTo<IEnumerable<Bp.Sync.Domain.Entities.FcBusinesses.Products.ProductShipment>, IEnumerable<FcProductShipmentElastic>>();
        }
        public static IEnumerable<FcUnitExchangeElastic> ToFcUnitExchanges(this IEnumerable<Bp.Sync.Domain.Entities.FcBusinesses.UnitExchanges.UnitExchange> model)
        {
            return model.MapTo<IEnumerable<Bp.Sync.Domain.Entities.FcBusinesses.UnitExchanges.UnitExchange>, IEnumerable<FcUnitExchangeElastic>>();
        }
        #endregion

    }
}
