using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace StandardScene.Model
{
    public class Configuration
    {
        public Conf conf { get; set; }
        public Dictionary<string, SimpleMission> Missions { get; set; }
        public Dictionary<string, SimpleMap> Maps { get; set; }
        public Dictionary<string, SimpleSite> Sites { get; set; }
        public Dictionary<string, Track> Tracks { get; set; }
        public Dictionary<string, object> Cars { get; set; } // Assuming Cars is an empty object
        public Dictionary<string, object> PrologScripts { get; set; } // Assuming PrologScripts is an empty object

        public Configuration()
        {
            // Initialize Conf with default values
            conf = new Conf
            {
                PRICE_RANGE = 10000.0,
                fields = new Dictionary<string, object>(),
                Car_UpdateInterval = 300,
                Search_AllowDestOnRoute = false,
                Search_RouteOnDestClearance = 0,
                Search_MaxVisitPerSite = 1,
                Search_MaxDupVisit = 1,
                Search_MaxKeepResult = 16,
                Traffic_MaxHoldingLocks = 3,
                Traffic_DeadLockSearchDepth = 0,
                DebugTypes = "S",
                Auto_Reprogram = false
            };

            Missions = new Dictionary<string, SimpleMission>();
            Maps = new Dictionary<string, SimpleMap>();
            Sites = new Dictionary<string, SimpleSite>();
            Tracks = new Dictionary<string, Track>();
            Cars = new Dictionary<string, object>();
            PrologScripts = new Dictionary<string, object>();
        }
    }

    public class Conf
    {
        public double PRICE_RANGE { get; set; }
        public Dictionary<string, object> fields { get; set; } // Assuming fields is an empty object
        public int Car_UpdateInterval { get; set; }
        public bool Search_AllowDestOnRoute { get; set; }
        public int Search_RouteOnDestClearance { get; set; }
        public int Search_MaxVisitPerSite { get; set; }
        public int Search_MaxDupVisit { get; set; }
        public int Search_MaxKeepResult { get; set; }
        public int Traffic_MaxHoldingLocks { get; set; }
        public int Traffic_DeadLockSearchDepth { get; set; }
        public string DebugTypes { get; set; }
        public bool Auto_Reprogram { get; set; }
    }

    public class SimpleMission
    {
        public string type { get; set; }
        public MissionOptions options { get; set; }
    }

    public class MissionOptions
    {
        public bool autoStart { get; set; }
        public int id { get; set; }
        public string layerName { get; set; }
        public string name { get; set; }
        public Dictionary<string, object> fields { get; set; } // Assuming fields is an empty object
    }

    public class SimpleMap
    {
        public string type { get; set; }
        public MapOptions options { get; set; }
    }

    public class MapOptions
    {
        public string filename { get; set; }
        public int id { get; set; }
        public string layerName { get; set; }
        public string name { get; set; }
        public Dictionary<string, object> fields { get; set; } // Assuming fields is an empty object
    }

    public class SimpleSite
    {
        public string color { get; set; }
        public string displaySetting { get; set; }
        public double x { get; set; }
        public double y { get; set; }
        public int id { get; set; }
        public string layerName { get; set; }
        public string name { get; set; }
        public Dictionary<string, string> fields { get; set; }
        public List<object> mustFree { get; set; } // Assuming mustFree is an empty array

        
    }

    public class Track
    {
        public string displaySetting { get; set; }
        public int siteA { get; set; }
        public int siteB { get; set; }
        public int direction { get; set; }
        public int id { get; set; }
        public string layerName { get; set; }
        public string name { get; set; }
        public Dictionary<string, string> fields { get; set; }
        public int _siteA { get; set; }
        public int _siteB { get; set; }

        public string typeInfo { get; set; }
        // public Dictionary<string, object> fields { get; set; }
    }
}
