using System;
using System.Collections.Generic;
using System.Text;
using Halo3Map.Data;

namespace Halo3Map.Tags.Layouts
{
    [Tag("shade45", "zone", 0.1)]
    public class zone : H3Tag
    {
        public int Unknown;

        public H3Reflexive<Unkn4> Unknown4;
        [Size(28)]
        public class Unkn4 : Chunk
        {
            public int Unknown;
            public int Unknown4;
            public int Unknown8;
            public int Unknown12;
            public int Unknown16;
            public int Unknown20;
            public int Unknown24;
        }

        public H3Reflexive<Unkn16> Unknown16;
        [Size(20)]
        public class Unkn16 : Chunk
        {
            public int Unknown;
            public int Unknown4;
            public int Unknown8;
            public int Unknown12;
            public int Unknown16;
        }

        [Size(60)]
        public byte[] Unknown28;

        public H3Reflexive<RawTable> rawTable;
        [Size(64)]
        public class RawTable : Chunk
        {
            public TagReference tag;
            public int Raw_Ident;
            public int Unknown20;
            public int Unknown24;
            public int Unknown28;
            public int Unknown32;
            public int Unknown36;

            public H3Reflexive<Unknown40> unknown40;
            [Size(8)]
            public class Unknown40 : Chunk
            {
                public int Unknown0;
                public int Unknown4;
            }

            public H3Reflexive<Unknown52> unknown52;
            [Size(8)]
            public class Unknown52 : Chunk
            {
                public int Unknown0;
                public int Unknown4;
            }
        }

        public H3Reflexive<Unkn100> Unknown100;
        [Size(120)]
        public class Unkn100 : Chunk
        {
            public H3Reflexive<Unkn> Unknown;
            [Size(4)]
            public class Unkn : Chunk
            {
                public int Unknown;
            }

            [Size(12)]
            public byte[] Unknown12;

            public H3Reflexive<Unkn> Unknown24;
            public H3Reflexive<Unkn> Unknown36;

            public int Unknown48;
            public int Unknown52;
            public int Unknown56;
            public int Unknown60;
            public int Unknown64;
            public int Unknown68;

            public H3Reflexive<Unkn72> Unknown72;
            [Size(20)]
            public class Unkn72 : Chunk
            {
                public int Unknown;
                public int Unknown4;
                public int Unknown8;
                public int Unknown12;
                public int Unknown16;
            }

            public H3Reflexive<Unkn84> Unknown84;
            [Size(4)]
            public class Unkn84 : Chunk
            {
                public int Unknown;
            }

            public H3Reflexive<Unkn84> Unknown96;

            public int Unknown108;
            public int Unknown112;
            public int Unknown116;
        }

        public H3Reflexive<Unkn100> Unknown112;

        [Size(12)]
        public byte[] Unknown124;

        //All these reflexive are exactly the same format a Unknown100
        public H3Reflexive<Unkn100> Unknown136; 
        public H3Reflexive<Unkn100> Unknown148;
        public H3Reflexive<Unkn100> Unknown160;
        public H3Reflexive<Unkn100> Unknown172;
        public H3Reflexive<Unkn100> Unknown184;
        public H3Reflexive<Unkn100> Unknown196;

        [Size(12)]
        public byte[] Unknown208;

        public H3Reflexive<Unkn100> Unknown220;
        ///////////////////////////////////////////////////////////////

        [Size(24)]
        public byte[] Unknown232;

        public H3Reflexive<Unkn256> Unknown256;
        [Size(36)]
        public class Unkn256 : Chunk
        {
            public int Unknown;
            public int Unknown4;
            public int Unknown8;
            public int Unknown12;
            public int Unknown16;
            public int Unknown20;
            public int Unknown24;
            public int Unknown28;
            public int Unknown32;
        }

        public H3Reflexive<Unkn268> Unknown268;
        [Size(16)]
        public class Unkn268 : Chunk
        {
            public TagReference sbsp;
        }

        [Size(36)]
        public byte[] Unknown280;

        public int TableOrSumthingOfTheSortSize;

        [Size(8)]
        public byte[] Unknown320;

        public int TableOrSumthingOfTheSortOffset;  // - map magic
        public int Unknown332;
        public int Unknown336;
        public int Unknown340;
        public int Unknown344;
        public int Unknown348;
        public int Unknown352;

        public H3Reflexive<Unkn356> Unknown356;
        [Size(20)]
        public class Unkn356 : Chunk
        {
            public int Unknown;
            public int Unknown4;
            public int Unknown8;
            public int Unknown12;
            public int Unknown16;
        }

        [Size(96)]
        public byte[] Unknown368;

        public H3Reflexive<Unknown464> unknown464;
        [Size(4)]
        public class Unknown464 : Chunk
        {
            public int Unknown;
        }

        public H3Reflexive<Unknown476> unknown476;
        [Size(8)]
        public class Unknown476 : Chunk
        {
            public int Unknown;
            public int Unknown4;
        }

        public H3Reflexive<Unknown488> unknown488;
        [Size(4)]
        public class Unknown488 : Chunk
        {
            public int Unknown;
        }

        public H3Reflexive<Unknown500> unknown500;
        [Size(8)]
        public class Unknown500 : Chunk
        {
            public short Unknown;
            public short Unknown2;
            public short Unknown4;
            public short Unknown6;
        }

        public H3Reflexive<Unknown512> unknown512;
        [Size(12)]
        public class Unknown512 : Chunk
        {
            public short Unknown;
            public short Unknown2;
            public int Unknown4;
            public int Unknown8;            
        }
    }
}
