using Valg.EVA.Skanning.Entity.SqlConnection;

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

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

        public void SaveToken(string token, string createdBy)
        {
            connectionFactory.SP_ExecuteVoid("EmergencyMode_InsertToken", new { CreatedBy = createdBy, Token = token });
        }

        public void Stop(string modifiedBy)
        {
            connectionFactory.SP_ExecuteVoid("EmergencyMode_Reset", new { ModifiedBy = modifiedBy });
        }
    }
}
