module Codec.Tiled.Tileset.WangColor 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 WangColor = WangColor
  { WangColor -> Text
color       :: Text                     -- ^ Hex-formatted color (#RRGGBB or #AARRGGBB)
  , WangColor -> Text
name        :: Text                     -- ^ Name of Wang color
  , WangColor -> Double
probability :: Double                   -- ^ Probability used when randomizing
  , WangColor -> Maybe (Vector Property)
properties  :: Maybe (Vector Property)  -- ^ Array of Properties
  , WangColor -> Int
tile        :: Int                      -- ^ Local ID of tile representing terrain
  }
  deriving (WangColor -> WangColor -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: WangColor -> WangColor -> Bool
$c/= :: WangColor -> WangColor -> Bool
== :: WangColor -> WangColor -> Bool
$c== :: WangColor -> WangColor -> Bool
Eq, Int -> WangColor -> ShowS
[WangColor] -> ShowS
WangColor -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [WangColor] -> ShowS
$cshowList :: [WangColor] -> ShowS
show :: WangColor -> String
$cshow :: WangColor -> String
showsPrec :: Int -> WangColor -> ShowS
$cshowsPrec :: Int -> WangColor -> ShowS
Show, forall x. Rep WangColor x -> WangColor
forall x. WangColor -> Rep WangColor x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep WangColor x -> WangColor
$cfrom :: forall x. WangColor -> Rep WangColor x
Generic)

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

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