using PARR.API.Services.Interfaces;
using System.Net;

namespace PARR.API.Services.Implementations
{
    public class ClientService : IClientService
    {
        private readonly IHttpContextAccessor httpContextAccessor;

        public ClientService(IHttpContextAccessor httpContextAccessor)
        {
            this.httpContextAccessor = httpContextAccessor;
        }
        public IPAddress? GetClientIp()
        {
            return httpContextAccessor.HttpContext?.Connection.RemoteIpAddress?.MapToIPv4();
        }
    }
}
