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

[System.Serializable]
public class TileFormat 
{
    public List<Road> roads = new List<Road>();

    public Dictionary<int, List<Road>> dictio = new Dictionary<int, List<Road>>
    {
        {0 , new List<Road>()},
        {1 , new List<Road>
            {
                new Road(new float[]{0, 0}, new float[]{0, 0}) //TODO remove?
            }
        },
        {2 , new List<Road>
            {
                new Road(new float[]{0, 0}, new float[]{1, 0})
            }
        },
        {3 , new List<Road>
            {
                new Road(new float[]{0, 0}, new float[]{1, 0}),
                new Road(new float[]{0, 0}, new float[]{0, 1})
            }
        },
        {4 , new List<Road>
            {
                new Road(new float[]{0, 0}, new float[]{1, 0}),
                new Road(new float[]{1, 0}, new float[]{1, 1}),
                new Road(new float[]{0, 1}, new float[]{0, 0})
            }
        },
        {5 , new List<Road>
            {
                new Road(new float[]{0, 0}, new float[]{1, 0}),
                new Road(new float[]{1, 0}, new float[]{1, 1}),
                new Road(new float[]{0, 1}, new float[]{0, 0}),
                new Road(new float[]{0, 1}, new float[]{1, 1})
            }
        },
        {6 , new List<Road>
            {
                new Road(new float[]{0, 0}, new float[]{1, 0}),
                new Road(new float[]{0, 0}, new float[]{0, 1}),
                new Road(new float[]{1, 1}, new float[]{1, 1})
            }
        },
        {7 , new List<Road>
            {
                new Road(new float[]{0, 0}, new float[]{1, 0}),
                new Road(new float[]{0, 1}, new float[]{1, 1})
            }
        },
        {8 , new List<Road>
            {
                new Road(new float[]{0, 0}, new float[]{1, 0}),
                new Road(new float[]{1, 1}, new float[]{1, 1})
            }
        },
        {9 , new List<Road>
            {
                new Road(new float[]{0, 0}, new float[]{1, 0}),
                new Road(new float[]{0, 1}, new float[]{0, 1}),
                new Road(new float[]{1, 1}, new float[]{1, 1})
            }
        },
        {10 , new List<Road>
            {
                new Road(new float[]{0, 0}, new float[]{0, 0}),
                new Road(new float[]{1, 0}, new float[]{1, 0}),
                new Road(new float[]{0, 1}, new float[]{0, 1}),
                new Road(new float[]{1, 1}, new float[]{1, 1})
            }
        },
        {11 , new List<Road>
            {
                new Road(new float[]{0, 0}, new float[]{0, 0}),
                new Road(new float[]{1, 0}, new float[]{1, 0}),
                new Road(new float[]{1, 1}, new float[]{1, 1})
            }
        },
        {12 , new List<Road>
            {
                new Road(new float[]{0, 0}, new float[]{0, 0}),
                new Road(new float[]{1, 1}, new float[]{1, 1})
            }
        },
        {13 , new List<Road>
            {
                new Road(new float[]{0, 0}, new float[]{0, 0}),
                new Road(new float[]{1, 0}, new float[]{1, 0})
            }
        },
        {14 , new List<Road>
            {
                new Road(new float[]{0, 0}, new float[]{1, 0}),
                new Road(new float[]{0, 1}, new float[]{0, 1})
            }
        },
    };

    public TileFormat (int formatNumber)
    {
        roads = dictio[formatNumber];
    }
    
    override public string ToString()
    {
        var str = "";
        foreach (var road in roads)
            str += road + ", ";
        return str;
    } 
}