using System;
using DG.Tweening;
using UniRx;
using UniRx.Triggers;
using UnityEngine;

namespace DialogueSystem.Diary
{
    public class Diary : MonoBehaviour
    {
        private void Awake()
        {
            transform.DOScale(4.2f, 2f)
                .SetLoops(-1, LoopType.Yoyo)
                .SetEase(Ease.InOutSine)
                .SetUpdate(true);
        }
        
        private void Start()
        {
            this.OnMouseDownAsObservable()
                .Subscribe(_ =>
                {
                    OnDiaryClicked();
                })
                .AddTo(this);

            this.OnMouseEnterAsObservable()
                .Subscribe(_ =>
                {
                    OnDiaryEnter();
                })
                .AddTo(this);


            this.OnMouseExitAsObservable()
                .Subscribe(_ =>
                {
                    OnDiaryExit();
                })
                .AddTo(this);
        }

        private void OnDiaryClicked()
        {
            DialogueManager.Instance.OpenDiaryWindow();
        }

        private void OnDiaryEnter()
        {
            
        }

        private void OnDiaryExit()
        {
            
        }
        
    }
}
