using System;
using Quadarax.Foundation.Core.Data.Interface.Domain;

namespace Quadarax.Foundation.Core.Data.Domain
{
    public class DomainContextResolver<TDomainContext> : IDomainContextResolver<TDomainContext> where TDomainContext: DataDomain
    {
        private TDomainContext _context;

        public DomainContextResolver(TDomainContext context)
        {
            _context = context ?? throw new ArgumentNullException(nameof(context));
        }


        public TReturnContext GetCurrent<TReturnContext>() where TReturnContext : TDomainContext
        {
            return (TReturnContext) _context;
        }
    }
}
