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

namespace HutongGames.PlayMaker.Actions
{
    public class RouteWrapper : Object
    {
        public List<OnlineMapsGoogleDirectionsResult.Step> steps;
        public List<OnlineMapsOpenRouteServiceDirectionResult.Step> orsSteps;
        public List<Vector2> orsPoints;

        public int count
        {
            get
            {
                if (orsSteps != null) return orsSteps.Count;
                return steps != null ? steps.Count : 0;
            }
        }

        public RouteWrapper(List<OnlineMapsGoogleDirectionsResult.Step> steps)
        {
            this.steps = steps;
        }

        public RouteWrapper(OnlineMapsOpenRouteServiceDirectionResult.Route route)
        {
            orsSteps = route.segments.SelectMany(s => s.steps).ToList();
            orsPoints = route.points.Cast<Vector2>().ToList();
        }
    }
}