module Codec.Tiled.Tileset.WangTile where

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

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

data WangTile = WangTile
  { WangTile -> Int
tileId :: Int        -- ^ Local ID of tile
  , WangTile -> Vector Int
wangId :: Vector Int -- ^ Array of Wang color indexes (uchar[8])
  }
  deriving (WangTile -> WangTile -> Bool
(WangTile -> WangTile -> Bool)
-> (WangTile -> WangTile -> Bool) -> Eq WangTile
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: WangTile -> WangTile -> Bool
$c/= :: WangTile -> WangTile -> Bool
== :: WangTile -> WangTile -> Bool
$c== :: WangTile -> WangTile -> Bool
Eq, Int -> WangTile -> ShowS
[WangTile] -> ShowS
WangTile -> String
(Int -> WangTile -> ShowS)
-> (WangTile -> String) -> ([WangTile] -> ShowS) -> Show WangTile
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [WangTile] -> ShowS
$cshowList :: [WangTile] -> ShowS
show :: WangTile -> String
$cshow :: WangTile -> String
showsPrec :: Int -> WangTile -> ShowS
$cshowsPrec :: Int -> WangTile -> ShowS
Show, (forall x. WangTile -> Rep WangTile x)
-> (forall x. Rep WangTile x -> WangTile) -> Generic WangTile
forall x. Rep WangTile x -> WangTile
forall x. WangTile -> Rep WangTile x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep WangTile x -> WangTile
$cfrom :: forall x. WangTile -> Rep WangTile x
Generic)

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

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