using Diligent.WebAPI.Business.MongoServices;
using Diligent.WebAPI.Data;
using Diligent.WebAPI.Data.Entities;
using Microsoft.Extensions.Options;
using MongoDB.Driver;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Diligent.WebAPI.Business.Services
{
    public class AuthorizationService : BaseMongo<Customer>
    {
        public AuthorizationService(IOptions<WebApiDatabaseSettings> webApiDatabaseSettings) :
           base(webApiDatabaseSettings, "Customer")
        { }
        public async Task<Customer> GetByUserName(string username)
        {
            return await _mongoCollection.Find(c => c.UserName == username).FirstOrDefaultAsync();
        }
    }
}
