@startuml
namespace model {
    class BaseMessage << (S,Aquamarine) >> {
        + Msg string

    }
    class Game << (S,Aquamarine) >> {
        - stop <font color=blue>chan</font> bool

        + ID string
        + Started bool
        + Title string
        + Owner *Player
        + Players <font color=blue>map</font>[int]*Player
        + Boards int
        + CanStartBeforeFull bool
        + Commands <font color=blue>chan</font> <font color=blue>func</font>(*Game) 

        - run() 

        + DoWork(f <font color=blue>func</font>(*Game) ) 
        + Stop() 
        + FindSpot() (bool, int)
        + FindPiece(pieceID string) (bool, *Piece, *Player)
        + GetPieceAtPoint(board int, x int, y int) (bool, *Piece)
        + MaxPlayers() int
        + PlayerByClient(client *ws.Client) (*Player, int, bool)
        + SetupBoards() 
        + IsReadyToStart() (bool, string)
        + ChangeSeat(client *ws.Client, seat int) 
        + RemoveClient(client *ws.Client) 
        + ChangeMoveFrom(client *ws.Client) 

    }
    class ListOfGames << (S,Aquamarine) >> {
        + Games []<font color=blue>map</font>[string]string

    }
    class MessageChangeSeat << (S,Aquamarine) >> {
        + Seat int

    }
    class MessageError << (S,Aquamarine) >> {
        + Msg string
        + Title string
        + Body string

    }
    class MessageJoinGame << (S,Aquamarine) >> {
        + ID string

    }
    class MessageListOfGames << (S,Aquamarine) >> {
        + Msg string
        + Games *ListOfGames

    }
    class MessageMove << (S,Aquamarine) >> {
        + PieceID string
        + ToX int
        + ToY int
        + Board int
        + Cache bool

    }
    class MessageNick << (S,Aquamarine) >> {
        + Nick string

    }
    class MessagePlace << (S,Aquamarine) >> {
        + ID string
        + ToX int
        + ToY int

    }
    class MessageSecret << (S,Aquamarine) >> {
        + Msg string
        + Secret string
        + ID string

    }
    class MessageShareState << (S,Aquamarine) >> {
        + Msg string
        + Game *Game

    }
    class MessageView << (S,Aquamarine) >> {
        + Msg string
        + View string

    }
    class MoveDescription << (S,Aquamarine) >> {
        + XDiff int
        + YDiff int
        + Down bool
        + Diagonal bool
        + BeingPlaced bool
        + BeingRemoved bool
        + MovingBoards bool
        + PawnOnSpawn bool
        + LastTwoRows bool
        + OtherBoard bool
        + LandingOnPiece *Piece
        + LandingOnPieceOwn bool
        + PiecesBetween []*Piece

    }
    class Piece << (S,Aquamarine) >> {
        + ID string
        + Identity int
        + X int
        + Y int
        + Color bool
        + Cache bool
        + Board int

        + Move(message *MessageMove) 
        + IsEqual(move *MessageMove) bool

    }
    class Player << (S,Aquamarine) >> {
        + Profile *Profile
        + Color bool
        + Team int
        + Pieces []*Piece
        + MyTurn bool
        + Board int

        - shouldGoDown() bool

        + GetPieceByID(id string) (*Piece, bool)
        + SetTeamColorAndBoard(spot int, boards int) 
        + SetupBoard() 
        + OwnsPiece(ID string) bool

    }
    class Profile << (S,Aquamarine) >> {
        + Client *ws.Client
        + Nick string
        + ID string
        + Secret string

    }
    class Server << (S,Aquamarine) >> {
        - handler <font color=blue>func</font>(*Server, *ws.Client, *[]byte) 

        + Address string
        + Lobby <font color=blue>map</font>[*ws.Client]*Profile
        + Games <font color=blue>map</font>[string]*Game
        + Todo <font color=blue>chan</font> *item
        + CanStartBeforeFull bool

        - run() 

        + GameByClientOwner(client *ws.Client) (bool, *Game)
        + GameByClientPlaying(client *ws.Client) (bool, *Game)
        + HandleMessage(client *ws.Client, msg *[]byte) 
        + GetOrCreateProfile(client *ws.Client) *Profile
        + CreateListOfGames() *ListOfGames
        + CreateMessageListOfGames() *MessageListOfGames

    }
    class Tile << (S,Aquamarine) >> {
        + X int

        + Equal(other *Tile) bool
        + GetTilesUntil(end *Tile) <font color=blue>chan</font> Tile

    }
    class item << (S,Aquamarine) >> {
        - client *ws.Client
        - msg *[]byte

    }
}


@enduml
