using System;
using UnityEngine;

namespace KitsuneCafe.Scripting
{
    [Serializable]
    public class BindingPath
    {
        [SerializeField]
        private string module;
        public string Module => module;

        [SerializeField]
        private string entity;
        public string Entity => entity;

        public static implicit operator (string, string)(BindingPath path) => (path.Module, path.Entity);
        public static implicit operator BindingPath((string, string) path) => new BindingPath(path.Item1, path.Item2);

        public BindingPath(string module, string entity)
        {
            this.module = module;
            this.entity = entity;
        }

        public override bool Equals(object obj)
        {
            return base.Equals(obj);
        }

        public override int GetHashCode()
        {
            return HashCode.Combine(module, entity);
        }

        public override string ToString()
        {
            return $"{module}:{entity}";
        }
    }
}
