module Codec.Tiled.Object where
import Data.Text (Text)
import Data.Vector (Vector)
import GHC.Generics (Generic)
import Codec.Tiled.Aeson (FromJSON(..), ToJSON(..), genericParseJSON, genericToJSON)
import Codec.Tiled.Object.Point (Point)
import Codec.Tiled.Object.Text qualified as Object (Text)
import Codec.Tiled.Property (Property)
import Data.Tiled.GID (GID)
data Object = Object
{ Object -> Maybe Bool
ellipse :: Maybe Bool
, Object -> Maybe GID
gid :: Maybe GID
, Object -> Double
height :: Double
, Object -> Int
id :: Int
, Object -> Text
name :: Text
, Object -> Maybe Bool
point :: Maybe Bool
, Object -> Maybe (Vector Point)
polygon :: Maybe (Vector Point)
, Object -> Maybe (Vector Point)
polyline :: Maybe (Vector Point)
, Object -> Maybe (Vector Property)
properties :: Maybe (Vector Property)
, Object -> Double
rotation :: Double
, Object -> Maybe FilePath
template :: Maybe FilePath
, Object -> Maybe Text
text :: Maybe Object.Text
, Object -> Text
type_ :: Text
, Object -> Bool
visible :: Bool
, Object -> Double
width :: Double
, Object -> Double
x :: Double
, Object -> Double
y :: Double
}
deriving (Object -> Object -> Bool
(Object -> Object -> Bool)
-> (Object -> Object -> Bool) -> Eq Object
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Object -> Object -> Bool
$c/= :: Object -> Object -> Bool
== :: Object -> Object -> Bool
$c== :: Object -> Object -> Bool
Eq, Int -> Object -> ShowS
[Object] -> ShowS
Object -> FilePath
(Int -> Object -> ShowS)
-> (Object -> FilePath) -> ([Object] -> ShowS) -> Show Object
forall a.
(Int -> a -> ShowS) -> (a -> FilePath) -> ([a] -> ShowS) -> Show a
showList :: [Object] -> ShowS
$cshowList :: [Object] -> ShowS
show :: Object -> FilePath
$cshow :: Object -> FilePath
showsPrec :: Int -> Object -> ShowS
$cshowsPrec :: Int -> Object -> ShowS
Show, (forall x. Object -> Rep Object x)
-> (forall x. Rep Object x -> Object) -> Generic Object
forall x. Rep Object x -> Object
forall x. Object -> Rep Object x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep Object x -> Object
$cfrom :: forall x. Object -> Rep Object x
Generic)
instance FromJSON Object where
parseJSON :: Value -> Parser Object
parseJSON = Value -> Parser Object
forall a. (Generic a, GFromJSON Zero (Rep a)) => Value -> Parser a
genericParseJSON
instance ToJSON Object where
toJSON :: Object -> Value
toJSON = Object -> Value
forall a. (Generic a, GToJSON' Value Zero (Rep a)) => a -> Value
genericToJSON