package client import ( "galaxy/model/order" "galaxy/model/report" ) type Client interface { // Version returns semantic version of the Client Version() string // Run initializes necessary UI layout an settings, and activates client's main window. // This is a blocking operation until client's main window is closed. Run() error // Shutdown closes client's main window and performing all necessary data persistence. Shutdown() // OnConnection receives an event when connection with client's server may be established (true) or connectivity lost (false). OnConnection(bool) // OnConnectionError receives an event when background process catches an error related to the server connectivity. OnConnectionError(error) // OnStorageError receives an event when background process catches an error related to the app's local Storage. OnStorageError(error) // OnServiceError receives an event when background process catches an unexpected processing error. OnServiceError(error) } type GameID string func (i GameID) String() string { return string(i) } type State struct { // TODO: store user's login key ClientCurrentVersion string `json:"clientCurrentVersion"` ClientNextVersion *string `json:"clientNextVersion,omitempty"` GameState []GameState `json:"gameState,omitempty"` ActiveGameID *GameID `json:"activeGameId,omitempty"` CameraZoom float64 `json:"cameraZoom"` CameraXFp int `json:"cameraXFp"` CameraYFp int `json:"cameraYFp"` MapSplitterOffset float64 `json:"mapSplitterOffset"` AccordionInfoOpen bool `json:"accInfoOpen"` AccordionCalcOpen bool `json:"accCalcOpen"` } type GameState struct { ID GameID `json:"id"` LastTurn uint `json:"lastTurn"` ActiveTurn uint `json:"activeTurn"` } type GameData struct { Turn uint `json:"turn"` Report report.Report `json:"report"` Order *order.Order `json:"order,omitempty"` }