module Rattletrap.Type.Attribute.ClubColors where import qualified Rattletrap.BitGet as BitGet import qualified Rattletrap.BitPut as BitPut import qualified Rattletrap.Schema as Schema import qualified Rattletrap.Type.U8 as U8 import qualified Rattletrap.Utility.Json as Json data ClubColors = ClubColors { ClubColors -> Bool blueFlag :: Bool, ClubColors -> U8 blueColor :: U8.U8, ClubColors -> Bool orangeFlag :: Bool, ClubColors -> U8 orangeColor :: U8.U8 } deriving (ClubColors -> ClubColors -> Bool (ClubColors -> ClubColors -> Bool) -> (ClubColors -> ClubColors -> Bool) -> Eq ClubColors forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a $c== :: ClubColors -> ClubColors -> Bool == :: ClubColors -> ClubColors -> Bool $c/= :: ClubColors -> ClubColors -> Bool /= :: ClubColors -> ClubColors -> Bool Eq, Int -> ClubColors -> ShowS [ClubColors] -> ShowS ClubColors -> String (Int -> ClubColors -> ShowS) -> (ClubColors -> String) -> ([ClubColors] -> ShowS) -> Show ClubColors forall a. (Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a $cshowsPrec :: Int -> ClubColors -> ShowS showsPrec :: Int -> ClubColors -> ShowS $cshow :: ClubColors -> String show :: ClubColors -> String $cshowList :: [ClubColors] -> ShowS showList :: [ClubColors] -> ShowS Show) instance Json.FromJSON ClubColors where parseJSON :: Value -> Parser ClubColors parseJSON = String -> (Object -> Parser ClubColors) -> Value -> Parser ClubColors forall a. String -> (Object -> Parser a) -> Value -> Parser a Json.withObject String "ClubColors" ((Object -> Parser ClubColors) -> Value -> Parser ClubColors) -> (Object -> Parser ClubColors) -> Value -> Parser ClubColors forall a b. (a -> b) -> a -> b $ \Object object -> do Bool blueFlag <- Object -> String -> Parser Bool forall value. FromJSON value => Object -> String -> Parser value Json.required Object object String "blue_flag" U8 blueColor <- Object -> String -> Parser U8 forall value. FromJSON value => Object -> String -> Parser value Json.required Object object String "blue_color" Bool orangeFlag <- Object -> String -> Parser Bool forall value. FromJSON value => Object -> String -> Parser value Json.required Object object String "orange_flag" U8 orangeColor <- Object -> String -> Parser U8 forall value. FromJSON value => Object -> String -> Parser value Json.required Object object String "orange_color" ClubColors -> Parser ClubColors forall a. a -> Parser a forall (f :: * -> *) a. Applicative f => a -> f a pure ClubColors {Bool blueFlag :: Bool blueFlag :: Bool blueFlag, U8 blueColor :: U8 blueColor :: U8 blueColor, Bool orangeFlag :: Bool orangeFlag :: Bool orangeFlag, U8 orangeColor :: U8 orangeColor :: U8 orangeColor} instance Json.ToJSON ClubColors where toJSON :: ClubColors -> Value toJSON ClubColors x = [(Key, Value)] -> Value Json.object [ String -> Bool -> (Key, Value) forall value e p. (ToJSON value, KeyValue e p) => String -> value -> p Json.pair String "blue_flag" (Bool -> (Key, Value)) -> Bool -> (Key, Value) forall a b. (a -> b) -> a -> b $ ClubColors -> Bool blueFlag ClubColors x, String -> U8 -> (Key, Value) forall value e p. (ToJSON value, KeyValue e p) => String -> value -> p Json.pair String "blue_color" (U8 -> (Key, Value)) -> U8 -> (Key, Value) forall a b. (a -> b) -> a -> b $ ClubColors -> U8 blueColor ClubColors x, String -> Bool -> (Key, Value) forall value e p. (ToJSON value, KeyValue e p) => String -> value -> p Json.pair String "orange_flag" (Bool -> (Key, Value)) -> Bool -> (Key, Value) forall a b. (a -> b) -> a -> b $ ClubColors -> Bool orangeFlag ClubColors x, String -> U8 -> (Key, Value) forall value e p. (ToJSON value, KeyValue e p) => String -> value -> p Json.pair String "orange_color" (U8 -> (Key, Value)) -> U8 -> (Key, Value) forall a b. (a -> b) -> a -> b $ ClubColors -> U8 orangeColor ClubColors x ] schema :: Schema.Schema schema :: Schema schema = String -> Value -> Schema Schema.named String "attribute-club-colors" (Value -> Schema) -> Value -> Schema forall a b. (a -> b) -> a -> b $ [((Key, Value), Bool)] -> Value Schema.object [ (String -> Value -> (Key, Value) forall value e p. (ToJSON value, KeyValue e p) => String -> value -> p Json.pair String "blue_flag" (Value -> (Key, Value)) -> Value -> (Key, Value) forall a b. (a -> b) -> a -> b $ Schema -> Value Schema.ref Schema Schema.boolean, Bool True), (String -> Value -> (Key, Value) forall value e p. (ToJSON value, KeyValue e p) => String -> value -> p Json.pair String "blue_color" (Value -> (Key, Value)) -> Value -> (Key, Value) forall a b. (a -> b) -> a -> b $ Schema -> Value Schema.ref Schema U8.schema, Bool True), (String -> Value -> (Key, Value) forall value e p. (ToJSON value, KeyValue e p) => String -> value -> p Json.pair String "orange_flag" (Value -> (Key, Value)) -> Value -> (Key, Value) forall a b. (a -> b) -> a -> b $ Schema -> Value Schema.ref Schema Schema.boolean, Bool True), (String -> Value -> (Key, Value) forall value e p. (ToJSON value, KeyValue e p) => String -> value -> p Json.pair String "orange_color" (Value -> (Key, Value)) -> Value -> (Key, Value) forall a b. (a -> b) -> a -> b $ Schema -> Value Schema.ref Schema U8.schema, Bool True) ] bitPut :: ClubColors -> BitPut.BitPut bitPut :: ClubColors -> BitPut bitPut ClubColors clubColorsAttribute = Bool -> BitPut BitPut.bool (ClubColors -> Bool blueFlag ClubColors clubColorsAttribute) BitPut -> BitPut -> BitPut forall a. Semigroup a => a -> a -> a <> U8 -> BitPut U8.bitPut (ClubColors -> U8 blueColor ClubColors clubColorsAttribute) BitPut -> BitPut -> BitPut forall a. Semigroup a => a -> a -> a <> Bool -> BitPut BitPut.bool (ClubColors -> Bool orangeFlag ClubColors clubColorsAttribute) BitPut -> BitPut -> BitPut forall a. Semigroup a => a -> a -> a <> U8 -> BitPut U8.bitPut (ClubColors -> U8 orangeColor ClubColors clubColorsAttribute) bitGet :: BitGet.BitGet ClubColors bitGet :: BitGet ClubColors bitGet = String -> BitGet ClubColors -> BitGet ClubColors forall a. String -> BitGet a -> BitGet a BitGet.label String "ClubColors" (BitGet ClubColors -> BitGet ClubColors) -> BitGet ClubColors -> BitGet ClubColors forall a b. (a -> b) -> a -> b $ do Bool blueFlag <- String -> BitGet Bool -> BitGet Bool forall a. String -> BitGet a -> BitGet a BitGet.label String "blueFlag" BitGet Bool BitGet.bool U8 blueColor <- String -> BitGet U8 -> BitGet U8 forall a. String -> BitGet a -> BitGet a BitGet.label String "blueColor" BitGet U8 U8.bitGet Bool orangeFlag <- String -> BitGet Bool -> BitGet Bool forall a. String -> BitGet a -> BitGet a BitGet.label String "orangeFlag" BitGet Bool BitGet.bool U8 orangeColor <- String -> BitGet U8 -> BitGet U8 forall a. String -> BitGet a -> BitGet a BitGet.label String "orangeColor" BitGet U8 U8.bitGet ClubColors -> BitGet ClubColors forall a. a -> Get BitString Identity a forall (f :: * -> *) a. Applicative f => a -> f a pure ClubColors {Bool blueFlag :: Bool blueFlag :: Bool blueFlag, U8 blueColor :: U8 blueColor :: U8 blueColor, Bool orangeFlag :: Bool orangeFlag :: Bool orangeFlag, U8 orangeColor :: U8 orangeColor :: U8 orangeColor}