implemented CreatePlayerState

This commit is contained in:
Jonathan Lamothe 2019-09-08 12:06:38 -04:00
parent be5d10b6fd
commit 6b73e367e4

View File

@ -29,6 +29,7 @@ module Mtlstats.Types (
ProgMode (..),
GameState (..),
GameType (..),
CreatePlayerState (..),
Database (..),
Player (..),
PlayerStats (..),
@ -53,6 +54,11 @@ module Mtlstats.Types (
awayScore,
overtimeFlag,
dataVerified,
-- ** CreatePlayerState Lenses
cpsNumber,
cpsName,
cpsPosition,
cpsConfirmed,
-- ** Database Lenses
dbPlayers,
dbGoalies,
@ -89,6 +95,7 @@ module Mtlstats.Types (
-- * Constructors
newProgState,
newGameState,
newCreatePlayerState,
newDatabase,
newPlayer,
newPlayerStats,
@ -187,6 +194,18 @@ data GameType
| AwayGame
deriving (Eq, Show)
-- | Player creation status
data CreatePlayerState = CreatePlayerState
{ _cpsNumber :: Maybe Int
-- ^ The player's number
, _cpsName :: String
-- ^ The player's name
, _cpsPosition :: String
-- ^ The player's position
, _cpsConfirmed :: Bool
-- ^ Set when the user confirms the input
} deriving (Eq, Show)
-- | Represents the database
data Database = Database
{ _dbPlayers :: [Player]
@ -408,6 +427,7 @@ data Prompt = Prompt
makeLenses ''ProgState
makeLenses ''GameState
makeLenses ''CreatePlayerState
makeLenses ''Database
makeLenses ''Player
makeLenses ''PlayerStats
@ -444,6 +464,15 @@ newGameState = GameState
, _dataVerified = False
}
-- | Constructor for a 'CreatePlayerState'
newCreatePlayerState :: CreatePlayerState
newCreatePlayerState = CreatePlayerState
{ _cpsNumber = Nothing
, _cpsName = ""
, _cpsPosition = ""
, _cpsConfirmed = False
}
-- | Constructor for a 'Database'
newDatabase :: Database
newDatabase = Database