using System;
using UniRx;
using UnityEngine;
using UnityEngine.UI;

public class BulkOrderIndicatorView : MonoBehaviour
{
    [SerializeField] private Button button;
    [SerializeField] private Animator phoneAnimator;
    [SerializeField] private Animator indicatorAnimator;
    [SerializeField] private GameObject titleObject;

    private static readonly int Ring = Animator.StringToHash("Ring");
    private static readonly int Speech = Animator.StringToHash("Speech");

    // [SerializeField] private Button button;
    public IObservable<Unit> TappedPhone => button.OnClickAsObservable().TakeUntilDestroy(this);

    public void SetIndicate(bool received, bool achieved)
    {
        if (!received)
        {
            phoneAnimator.SetTrigger(Ring);
            indicatorAnimator.SetTrigger(Speech);
        }
        titleObject.SetActive(received && !achieved);
    }
}
