module Codec.Tiled.Tileset.Terrain where

import Data.Text (Text)
import Data.Vector (Vector)
import GHC.Generics (Generic)

import Codec.Tiled.Aeson (FromJSON(..), ToJSON(..), genericParseJSON, genericToJSON)
import Codec.Tiled.Property (Property)

data Terrain = Terrain
  { Terrain -> Text
name       :: Text                    -- ^ Name of terrain
  , Terrain -> Maybe (Vector Property)
properties :: Maybe (Vector Property) -- ^ array Array of Properties
  , Terrain -> Int
tile       :: Int                     -- ^ Local ID of tile representing terrain
  }
  deriving (Terrain -> Terrain -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Terrain -> Terrain -> Bool
$c/= :: Terrain -> Terrain -> Bool
== :: Terrain -> Terrain -> Bool
$c== :: Terrain -> Terrain -> Bool
Eq, Int -> Terrain -> ShowS
[Terrain] -> ShowS
Terrain -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Terrain] -> ShowS
$cshowList :: [Terrain] -> ShowS
show :: Terrain -> String
$cshow :: Terrain -> String
showsPrec :: Int -> Terrain -> ShowS
$cshowsPrec :: Int -> Terrain -> ShowS
Show, forall x. Rep Terrain x -> Terrain
forall x. Terrain -> Rep Terrain x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep Terrain x -> Terrain
$cfrom :: forall x. Terrain -> Rep Terrain x
Generic)

instance FromJSON Terrain where
  parseJSON :: Value -> Parser Terrain
parseJSON = forall a. (Generic a, GFromJSON Zero (Rep a)) => Value -> Parser a
genericParseJSON

instance ToJSON Terrain where
  toJSON :: Terrain -> Value
toJSON = forall a. (Generic a, GToJSON' Value Zero (Rep a)) => a -> Value
genericToJSON