using System.Collections;
using System.Collections.Generic;
using UnityEngine;

namespace SimplifyXR
{

    [DirectiveCategory(DirectiveCategories.Action,
        subCategory = DirectiveSubCategory.UI,
        directiveInfo = "This <i>action</i> explicitly sets the <b>Object Anchor pose</b> in the scene during alignment.",
        prettyName = "Set Object Anchor Pose")]
    public class SetObjectAnchorPose : Actions
    {
        public ObjectAnchorPanelFeatures objectAnchorPanel;

        [Tooltip("Uses the current pose the object anchor, such as during placement.")]
        public bool useCurrentPose = false;
        
        [Tooltip("Position of the anchor to set and place")]
        public Vector3 position;
        [Tooltip("Rotation of the anchor to set and place")]
        public Vector3 rotation;

        public override List<KnobKeywords> ReceiveKeywords()
        {
            return new List<KnobKeywords>();
        }

        public override List<KnobKeywords> SendKeywords()
        {
            return new List<KnobKeywords>();
        }

        public override void Execute()
        {
            objectAnchorPanel = 
                objectAnchorPanel == null ? 
                Object.FindObjectOfType<ObjectAnchorPanelFeatures>() :
                objectAnchorPanel;
            objectAnchorPanel?.SetObjectAnchorPose(position, rotation, useCurrentPose);
            ThisActionCompleted();
        }
    }
}

