using Valg.EVA.Skanning.Entity.SqlConnection;

namespace Valg.EVA.Skanning.Repositories.EmergencyMode
{
    public class EmergencyModeRepository : IEmergencyModeRepository
    {
        private readonly ISqlConnectionFactory connectionFactory;

        public EmergencyModeRepository(ISqlConnectionFactory connectionFactory)
        {
            this.connectionFactory = connectionFactory;
        }

        public bool IsEmergencyModeActive()
        {
            var activeRows = connectionFactory.SP_Execute<int>("EmergencyMode_IsActive");
            return activeRows == 1;
        }

        public string GetActiveToken()
        {
            return connectionFactory.SP_Get<string>("EmergencyMode_GetToken");
        }
    }
}
