{-# LANGUAGE DeriveGeneric #-}

module Battlesnake.Core.Battlesnake where

import Battlesnake.Core.Coordinate (Coordinate)
import Data.Aeson (FromJSON, ToJSON)
import Data.Text
import GHC.Generics


{-| 
  A snake in the game.
  See: https://docs.battlesnake.com/api/objects/battlesnake
-}
data Battlesnake = Battlesnake
  { Battlesnake -> Text
id :: Text, -- ^ The ID of the snake.
    Battlesnake -> Text
name :: Text, -- ^ The name of the snake.
    Battlesnake -> Integer
health :: Integer, -- ^ Current health of the snake (0-100).
    Battlesnake -> [Coordinate]
body :: [Coordinate], -- ^ A list of coordinates representing the snake's body.
    Battlesnake -> Text
latency :: Text, -- ^ The snake's latency.
    Battlesnake -> Coordinate
head :: Coordinate, -- ^ The position of the snakes head
    Battlesnake -> Integer
length :: Integer, -- ^ The length of the snake.
    Battlesnake -> Text
shout :: Text, -- ^ The snake's last moves shout.
    Battlesnake -> Maybe Text
squad :: Maybe Text -- ^ The squad the snake is a part of (In squad mode).
  }
  deriving (Int -> Battlesnake -> ShowS
[Battlesnake] -> ShowS
Battlesnake -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Battlesnake] -> ShowS
$cshowList :: [Battlesnake] -> ShowS
show :: Battlesnake -> String
$cshow :: Battlesnake -> String
showsPrec :: Int -> Battlesnake -> ShowS
$cshowsPrec :: Int -> Battlesnake -> ShowS
Show, forall x. Rep Battlesnake x -> Battlesnake
forall x. Battlesnake -> Rep Battlesnake x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep Battlesnake x -> Battlesnake
$cfrom :: forall x. Battlesnake -> Rep Battlesnake x
Generic)

instance ToJSON Battlesnake

instance FromJSON Battlesnake