// Copyright © Selmo Technology GmbH. All Rights Reserved

using Novus.Connectivity.Common;
using Novus.Connectivity.Plc;
using Novus.Connectivity.Service;
using Novus.Shared.Types.Nothing;
using Novus.Shared.Types.Result;
using SelmoStudio.Hmi.Server.SelmoHmi.Shared.Component;

namespace SelmoStudio.Hmi.Server.ProcessValue.Services
{
    public interface IProcessValuePollingService
    {
        event EventHandler OnIntervalElapsed;

        public DeviceId DeviceId { get; }
        public DateTimeOffset LastValueChange { get; }

        bool IsReady();

        bool IsConnectionActive();

        void Init(IConnectionSettings settings);

        void Reconnect();

        void RegisterValues(ValuesConnectionRegistration registration);

        void UnRegisterValues(ValuesConnectionRegistrationId id);

        Task<OperationResult<ValueInfo>> GetValues(ValuesConnectionRegistrationId id);

        Task<OperationResult<ValueInfo>> GetAllValues();

        public Task<OperationResult<Nothing>> WriteValue(IProcessValue value);

        public void HandleEvent(ComponentEventArgs e);
    }
}