{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE OverloadedStrings #-}

module Battlesnake.API.InfoResponse where

import Data.Aeson (ToJSON, Value (String), toJSON)
import Data.Text
import GHC.Generics

-- | Supported versions of the Battlesnake API
data APIVersion = APIVersion1 deriving (Int -> APIVersion -> ShowS
[APIVersion] -> ShowS
APIVersion -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [APIVersion] -> ShowS
$cshowList :: [APIVersion] -> ShowS
show :: APIVersion -> String
$cshow :: APIVersion -> String
showsPrec :: Int -> APIVersion -> ShowS
$cshowsPrec :: Int -> APIVersion -> ShowS
Show)

instance ToJSON APIVersion where
  toJSON :: APIVersion -> Value
toJSON APIVersion
APIVersion1 = Text -> Value
String Text
"1"

{-|
  The response to an info request.
  This can be used to modify the appearance of your snake on the game board.
-}
data InfoResponse = InfoResponse
  { InfoResponse -> APIVersion
apiversion :: APIVersion
  -- ^ The API version supported by the battlesnake server (currently 1).
  , InfoResponse -> Maybe Text
author :: Maybe Text
  -- ^ The username of the author of the snake.
  , InfoResponse -> Maybe Text
color :: Maybe Text
  -- ^ A color code used to set the color of the snake.
  , InfoResponse -> Maybe Text
head :: Maybe Text
  -- ^ A custom head to use for the snake. (See https://play.battlesnake.com/customizations for options.)
  , InfoResponse -> Maybe Text
tail :: Maybe Text
  -- ^ A custom tail to use for the snake. (See https://play.battlesnake.com/customizations for options.)
  , InfoResponse -> Maybe Text
version :: Maybe Text
  -- ^ The version of the snake.
  }
  deriving (Int -> InfoResponse -> ShowS
[InfoResponse] -> ShowS
InfoResponse -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [InfoResponse] -> ShowS
$cshowList :: [InfoResponse] -> ShowS
show :: InfoResponse -> String
$cshow :: InfoResponse -> String
showsPrec :: Int -> InfoResponse -> ShowS
$cshowsPrec :: Int -> InfoResponse -> ShowS
Show, forall x. Rep InfoResponse x -> InfoResponse
forall x. InfoResponse -> Rep InfoResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep InfoResponse x -> InfoResponse
$cfrom :: forall x. InfoResponse -> Rep InfoResponse x
Generic)

instance ToJSON InfoResponse