module Codec.Tiled.Tileset.WangSet 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)
import Codec.Tiled.Tileset.WangColor (WangColor)
import Codec.Tiled.Tileset.WangTile (WangTile)

data WangSet = WangSet
  { WangSet -> Vector WangColor
colors     :: Vector WangColor        -- ^ Array of Wang colors (since 1.5)
  , WangSet -> Text
name       :: Text                    -- ^ Name of terrain
  , WangSet -> Maybe (Vector Property)
properties :: Maybe (Vector Property) -- ^ array Array of Properties
  , WangSet -> Int
tile       :: Int                     -- ^ Local ID of tile representing terrain
  , WangSet -> Text
type_      :: Text                    -- ^ @corner@, @edge@ or @mixed@ (since 1.5)
  , WangSet -> Vector WangTile
wangTiles  :: Vector WangTile         -- ^ Array of Wang tiles
  }
  deriving (WangSet -> WangSet -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: WangSet -> WangSet -> Bool
$c/= :: WangSet -> WangSet -> Bool
== :: WangSet -> WangSet -> Bool
$c== :: WangSet -> WangSet -> Bool
Eq, Int -> WangSet -> ShowS
[WangSet] -> ShowS
WangSet -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [WangSet] -> ShowS
$cshowList :: [WangSet] -> ShowS
show :: WangSet -> String
$cshow :: WangSet -> String
showsPrec :: Int -> WangSet -> ShowS
$cshowsPrec :: Int -> WangSet -> ShowS
Show, forall x. Rep WangSet x -> WangSet
forall x. WangSet -> Rep WangSet x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep WangSet x -> WangSet
$cfrom :: forall x. WangSet -> Rep WangSet x
Generic)

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

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