using System;
using System.Collections.Generic;
using System.Text;

namespace GameMaker.Models
{
    public class WorldDefinition
    {
        public Int32 Key { get; set; }
        public String Name { get; set; }
        public String Filename { get; set; }
        public Boolean ShowMiniMap { get; set; }
        public IList<WorldCellDefinition> Cells { get; set; }


        public WorldDefinition()
        {
            this.Cells = new List<WorldCellDefinition>();
            this.Name = "NEW WORLD";
        }


        public String GetFileName()
        {
            String num = "000" + this.Key;

            num = num.Substring(num.Length - 3, 3);

            return "worldmap-" + num + ".csv";
        }


        public static String GetCsvTitle()
        {
            return "Key,Name,Filename,ShowMiniMap";
        }


        public String ToCsvString()
        {
            StringBuilder line = new StringBuilder();

            line.Append(Key);
            line.Append(',');
            line.Append(Name);
            line.Append(',');
            line.Append(Filename);
            line.Append(',');
            line.Append(ShowMiniMap);

            return line.ToString();
        }


    }
}
