using System;

namespace Intrepid.Gameplay.Journey
{
    [Serializable]
    public sealed class JConnection
    {
        public string id;
        public string endpointAId;
        public string endpointBId;
        public JConnectionDirectionality directionality = JConnectionDirectionality.Bidirectional;

        public bool ContainsEndpoint(string endpointId)
        {
            return endpointAId == endpointId || endpointBId == endpointId;
        }

        public string GetOtherEndpointId(string endpointId)
        {
            if (endpointAId == endpointId)
            {
                return endpointBId;
            }

            if (endpointBId == endpointId)
            {
                return endpointAId;
            }

            return null;
        }
    }
}
