﻿using UnityEngine;

namespace pdinklag
{
    public static class HumanBodyBonesExtension
    {
        public static Transform For(this HumanBodyBones bone, Animator anim)
        {
            return anim.GetBoneTransform(bone);
        }

        public static Vector3 PositionFor(this HumanBodyBones bone, Animator anim)
        {
            return anim.GetBoneTransform(bone).position;
        }

        public static HumanBodyBones Mirror(this HumanBodyBones bone)
        {
            return bone switch
            {
                HumanBodyBones.LeftUpperLeg => HumanBodyBones.RightUpperLeg,
                HumanBodyBones.LeftLowerLeg => HumanBodyBones.RightLowerLeg,
                HumanBodyBones.LeftFoot => HumanBodyBones.RightFoot,
                HumanBodyBones.LeftShoulder => HumanBodyBones.RightShoulder,
                HumanBodyBones.LeftUpperArm => HumanBodyBones.RightUpperArm,
                HumanBodyBones.LeftLowerArm => HumanBodyBones.RightLowerArm,
                HumanBodyBones.LeftHand => HumanBodyBones.RightHand,
                HumanBodyBones.LeftToes => HumanBodyBones.RightToes,
                HumanBodyBones.LeftEye => HumanBodyBones.RightEye,
                HumanBodyBones.LeftThumbProximal => HumanBodyBones.RightThumbProximal,
                HumanBodyBones.LeftThumbIntermediate => HumanBodyBones.RightThumbIntermediate,
                HumanBodyBones.LeftThumbDistal => HumanBodyBones.RightThumbDistal,
                HumanBodyBones.LeftIndexProximal => HumanBodyBones.RightIndexProximal,
                HumanBodyBones.LeftIndexIntermediate => HumanBodyBones.RightIndexIntermediate,
                HumanBodyBones.LeftIndexDistal => HumanBodyBones.RightIndexDistal,
                HumanBodyBones.LeftMiddleProximal => HumanBodyBones.RightMiddleProximal,
                HumanBodyBones.LeftMiddleIntermediate => HumanBodyBones.RightMiddleIntermediate,
                HumanBodyBones.LeftMiddleDistal => HumanBodyBones.RightMiddleDistal,
                HumanBodyBones.LeftRingProximal => HumanBodyBones.RightRingProximal,
                HumanBodyBones.LeftRingIntermediate => HumanBodyBones.RightRingIntermediate,
                HumanBodyBones.LeftRingDistal => HumanBodyBones.RightRingDistal,
                HumanBodyBones.LeftLittleProximal => HumanBodyBones.RightLittleProximal,
                HumanBodyBones.LeftLittleIntermediate => HumanBodyBones.RightLittleIntermediate,
                HumanBodyBones.LeftLittleDistal => HumanBodyBones.RightLittleDistal,
                HumanBodyBones.RightUpperLeg => HumanBodyBones.LeftUpperLeg,
                HumanBodyBones.RightLowerLeg => HumanBodyBones.LeftLowerLeg,
                HumanBodyBones.RightFoot => HumanBodyBones.LeftFoot,
                HumanBodyBones.RightShoulder => HumanBodyBones.LeftShoulder,
                HumanBodyBones.RightUpperArm => HumanBodyBones.LeftUpperArm,
                HumanBodyBones.RightLowerArm => HumanBodyBones.LeftLowerArm,
                HumanBodyBones.RightHand => HumanBodyBones.LeftHand,
                HumanBodyBones.RightToes => HumanBodyBones.LeftToes,
                HumanBodyBones.RightEye => HumanBodyBones.LeftEye,
                HumanBodyBones.RightThumbProximal => HumanBodyBones.LeftThumbProximal,
                HumanBodyBones.RightThumbIntermediate => HumanBodyBones.LeftThumbIntermediate,
                HumanBodyBones.RightThumbDistal => HumanBodyBones.LeftThumbDistal,
                HumanBodyBones.RightIndexProximal => HumanBodyBones.LeftIndexProximal,
                HumanBodyBones.RightIndexIntermediate => HumanBodyBones.LeftIndexIntermediate,
                HumanBodyBones.RightIndexDistal => HumanBodyBones.LeftIndexDistal,
                HumanBodyBones.RightMiddleProximal => HumanBodyBones.LeftMiddleProximal,
                HumanBodyBones.RightMiddleIntermediate => HumanBodyBones.LeftMiddleIntermediate,
                HumanBodyBones.RightMiddleDistal => HumanBodyBones.LeftMiddleDistal,
                HumanBodyBones.RightRingProximal => HumanBodyBones.LeftRingProximal,
                HumanBodyBones.RightRingIntermediate => HumanBodyBones.LeftRingIntermediate,
                HumanBodyBones.RightRingDistal => HumanBodyBones.LeftRingDistal,
                HumanBodyBones.RightLittleProximal => HumanBodyBones.LeftLittleProximal,
                HumanBodyBones.RightLittleIntermediate => HumanBodyBones.LeftLittleIntermediate,
                HumanBodyBones.RightLittleDistal => HumanBodyBones.LeftLittleDistal,
                _ => bone,
            };
        }
    }
}
