using System;
using System.Security.Principal;
using Microsoft.Extensions.Logging;
using Quadarax.Foundation.Core.Data.Interface.Repository;

namespace Quadarax.Foundation.Core.Business
{
    public abstract class AbstractMultiRepositoryService<TRepository1,TRepository2> : AbstractService 
        where TRepository1: IRepository
        where TRepository2: IRepository
    {
        protected TRepository1 Repository1 { get; }
        protected TRepository2 Repository2 { get; }

        protected AbstractMultiRepositoryService(TRepository1 repository1, TRepository2 repository2,IPrincipal currentPrincipal,  ILoggerFactory logger) : base(currentPrincipal, logger)
        {
            Repository1 = repository1 ?? throw new ArgumentNullException(nameof(repository1));
            Repository2 = repository2 ?? throw new ArgumentNullException(nameof(repository2));
        }
    }


    public abstract class AbstractMultiRepositoryService<TRepository1,TRepository2, TRepository3> : AbstractService 
        where TRepository1: IRepository
        where TRepository2: IRepository
        where TRepository3: IRepository
    {
        protected TRepository1 Repository1 { get; }
        protected TRepository2 Repository2 { get; }
        protected TRepository3 Repository3 { get; }

        protected AbstractMultiRepositoryService(TRepository1 repository1, TRepository2 repository2, TRepository3 repository3,IPrincipal currentPrincipal, ILoggerFactory logger) : base(currentPrincipal, logger)
        {
            Repository1 = repository1 ?? throw new ArgumentNullException(nameof(repository1));
            Repository2 = repository2 ?? throw new ArgumentNullException(nameof(repository2));
            Repository3 = repository3 ?? throw new ArgumentNullException(nameof(repository3));
        }
    }

    public abstract class AbstractMultiRepositoryService<TRepository1,TRepository2, TRepository3, TRepository4> : AbstractService 
        where TRepository1: IRepository
        where TRepository2: IRepository
        where TRepository3: IRepository
        where TRepository4: IRepository
    {
        protected TRepository1 Repository1 { get; }
        protected TRepository2 Repository2 { get; }
        protected TRepository3 Repository3 { get; }
        protected TRepository4 Repository4 { get; }

        protected AbstractMultiRepositoryService(TRepository1 repository1, TRepository2 repository2, TRepository3 repository3,TRepository4 repository4, IPrincipal currentPrincipal, ILoggerFactory logger) : base(currentPrincipal, logger)
        {
            Repository1 = repository1 ?? throw new ArgumentNullException(nameof(repository1));
            Repository2 = repository2 ?? throw new ArgumentNullException(nameof(repository2));
            Repository3 = repository3 ?? throw new ArgumentNullException(nameof(repository3));
            Repository4 = repository4 ?? throw new ArgumentNullException(nameof(repository4));
        }
    }


    public abstract class AbstractMultiRepositoryService<TRepository1,TRepository2, TRepository3, TRepository4, TRepository5> : AbstractService 
        where TRepository1: IRepository
        where TRepository2: IRepository
        where TRepository3: IRepository
        where TRepository4: IRepository
        where TRepository5: IRepository
    {
        protected TRepository1 Repository1 { get; }
        protected TRepository2 Repository2 { get; }
        protected TRepository3 Repository3 { get; }
        protected TRepository4 Repository4 { get; }
        protected TRepository5 Repository5 { get; }

        protected AbstractMultiRepositoryService(TRepository1 repository1, TRepository2 repository2, TRepository3 repository3,TRepository4 repository4,TRepository5 repository5,IPrincipal currentPrincipal, ILoggerFactory logger) : base(currentPrincipal, logger)
        {
            Repository1 = repository1 ?? throw new ArgumentNullException(nameof(repository1));
            Repository2 = repository2 ?? throw new ArgumentNullException(nameof(repository2));
            Repository3 = repository3 ?? throw new ArgumentNullException(nameof(repository3));
            Repository4 = repository4 ?? throw new ArgumentNullException(nameof(repository4));
            Repository5 = repository5 ?? throw new ArgumentNullException(nameof(repository5));
        }
    }
}
