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

namespace HutongGames.PlayMaker.Actions
{
    public class RouteWrapper : Object
    {
        public List<GoogleRoutingResult.RouteLegStep> steps;
        public List<ORSDirectionsResult.Step> orsSteps;
        public List<GeoPoint> orsPoints;

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

        public RouteWrapper(List<GoogleRoutingResult.RouteLegStep> steps)
        {
            this.steps = steps;
        }

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