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

namespace MassSHARD.Model
{
    public class massShardTable
    {
        public string Table;
        public string Field;
        public bool Primary;
        public massShardTable(bool primary, string t, string f)
        {
            Table = t;
            Field = f;
            Primary = primary;
        }
    }

    public class massSpaceField
    {
        public string Formula;
        public string AsName;
        public massSpaceField(string f)
        {
            Formula = f;
            AsName = "";
        }
    }

    public interface massSpaceElement
    {
    }

    public class massSpaceTable : massSpaceElement
    {
        public List<massSpaceField> Fields;
        public string Table;

        public massSpaceTable(string tbl)
        {
            Table = tbl;
            Fields = new List<massSpaceField>();
        }
    }

    public enum JoinMode
    {
        Cross, Left
    }

    public class massSpaceJoin : massSpaceElement
    {
        public massSpaceElement A;
        public massSpaceElement B;
        public JoinMode Mode;
        public bool HasCondition;
        public string X;
        public string Y;

        public massSpaceJoin(JoinMode m, massSpaceElement a, massSpaceElement b)
        {
            A = a;
            B = b;
            Mode = m;
            HasCondition = false;
            
        }

        public void SetCondition(string x, string y)
        {
            HasCondition = true;
            X = x;
            Y = y;
        }
    }

    public class massSpace
    {
        public string Name;
        public massSpaceElement Perspective;
        public massSpace(string n, massSpaceElement p)
        {
            Name = n;
            Perspective = p;
        }
    }

    public class massGroup
    {
        public string                  Name;
        public List<massShardTable>  Members;
        public List<massSpace>  Spaces;
        public massGroup(string n)
        {
            Name = n;
            Members = new List<massShardTable>();
            Spaces = new List<massSpace>();
        }
    }
}
