using BarRaider.SdTools;
using ClipTrimDotNet.Client;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ClipTrimDotNet.Keys
{
    [PluginActionId("com.michal-courson.cliptrim.clip-save")]
    public class ClipSave : KeypadBase
    {
        public ClipSave(SDConnection connection, InitialPayload payload) : base(connection, payload)
        {
            GlobalSettingsManager.Instance.RequestGlobalSettings();
        }
        public void Instance_OnReceivedGlobalSettings(object sender, ReceivedGlobalSettingsPayload e)
        {
            Tools.AutoPopulateSettings(GlobalSettings.Instance, e.Settings);
        }
        public override void Dispose()
        {
        }
        public override void KeyPressed(KeyPayload payload)
        {
            ClipTrimClient.Instance.SaveClip();
        }


        public override void OnTick()
        { 
        }

        public override void KeyReleased(KeyPayload payload)
        {

        }

        public override void ReceivedSettings(ReceivedSettingsPayload payload)
        {

        }
        public override void ReceivedGlobalSettings(ReceivedGlobalSettingsPayload payload)
        {
            Tools.AutoPopulateSettings(GlobalSettings.Instance, payload.Settings);
        }
    }
}
