using System.Collections.Generic;
using UnityEngine;

public class YogaDataLoader
{

    public static YogaData LoadData(int index)
    {
        //Resources.Load<TextAsset>("YogaActions/YogaAction" + ActionIndex);

        Dictionary<int, YogaData> data = new Dictionary<int, YogaData>();

#if UNITY_EDITOR
        data[-1] = new YogaData()
        {
            VideoPath = "Video/Action3",
            Action = AvatarAction.HandsUp,
            ModelType = ModelType.MediapipePose,
            MaxActionCount = 1000,
            TotalSeconds = 20.0f,
            MustPoints = new List<string>() { "Nose", "RShoulder", "LShoulder", "RElbow", "LElbow" },
            //AnyPoints = new List<string>() { "RWrist", "LWrist" }
        };
#endif
        data[1] = new YogaData()
        {
            VideoPath = "Video/Action1",
            Action = AvatarAction.HeadShake,
            ModelType = ModelType.OpenPose,
            MaxActionCount = 4,
            TotalSeconds = 20.0f,
            MustPoints = new List<string>() { "Nose", "REye", "LEye", "Neck" }
        };
        data[2] = new YogaData()
        {
            VideoPath = "Video/Action2",
            Action = AvatarAction.Nod,
            ModelType = ModelType.OpenPose,
            MaxActionCount = 4,
            TotalSeconds = 20.0f,
            MustPoints = new List<string>() { "Nose", "REye", "LEye", "Neck" }
        };
        data[3] = new YogaData()
        {
            VideoPath = "Video/Action3",
            Action = AvatarAction.HandsUp,
            ModelType = ModelType.MediapipePose,
            MaxActionCount = 4,
            TotalSeconds = 12.66f,
            MustPoints = new List<string>() { "Nose", "RShoulder", "LShoulder", "RElbow", "LElbow" }
        };

        if (data.ContainsKey(index))
            return data[index];
        else
        {
            Debug.LogError("YogaDataLoader.LoadData: index out of range");
        }

        return null;
    }
}

public class YogaData
{
    public string VideoPath;
    public AvatarAction Action;
    public ModelType ModelType;
    public int MaxActionCount;
    public float TotalSeconds;
    public List<string> MustPoints = new List<string>();
    public List<string> AnyPoints = new List<string>();
}

public enum ModelType
{
    OpenPose,
    YoloV7,
    MediapipePose,
    MediapipePersonDetect,
    //,
}