module Rattletrap.Type.Attribute.Loadouts where import qualified Rattletrap.BitGet as BitGet import qualified Rattletrap.BitPut as BitPut import qualified Rattletrap.Schema as Schema import qualified Rattletrap.Type.Attribute.Loadout as Loadout import qualified Rattletrap.Utility.Json as Json data Loadouts = Loadouts { Loadouts -> Loadout blue :: Loadout.Loadout, Loadouts -> Loadout orange :: Loadout.Loadout } deriving (Loadouts -> Loadouts -> Bool forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a /= :: Loadouts -> Loadouts -> Bool $c/= :: Loadouts -> Loadouts -> Bool == :: Loadouts -> Loadouts -> Bool $c== :: Loadouts -> Loadouts -> Bool Eq, Int -> Loadouts -> ShowS [Loadouts] -> ShowS Loadouts -> String forall a. (Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a showList :: [Loadouts] -> ShowS $cshowList :: [Loadouts] -> ShowS show :: Loadouts -> String $cshow :: Loadouts -> String showsPrec :: Int -> Loadouts -> ShowS $cshowsPrec :: Int -> Loadouts -> ShowS Show) instance Json.FromJSON Loadouts where parseJSON :: Value -> Parser Loadouts parseJSON = forall a. String -> (Object -> Parser a) -> Value -> Parser a Json.withObject String "Loadouts" forall a b. (a -> b) -> a -> b $ \Object object -> do Loadout blue <- forall value. FromJSON value => Object -> String -> Parser value Json.required Object object String "blue" Loadout orange <- forall value. FromJSON value => Object -> String -> Parser value Json.required Object object String "orange" forall (f :: * -> *) a. Applicative f => a -> f a pure Loadouts {Loadout blue :: Loadout blue :: Loadout blue, Loadout orange :: Loadout orange :: Loadout orange} instance Json.ToJSON Loadouts where toJSON :: Loadouts -> Value toJSON Loadouts x = [(Key, Value)] -> Value Json.object [forall value p. (ToJSON value, KeyValue p) => String -> value -> p Json.pair String "blue" forall a b. (a -> b) -> a -> b $ Loadouts -> Loadout blue Loadouts x, forall value p. (ToJSON value, KeyValue p) => String -> value -> p Json.pair String "orange" forall a b. (a -> b) -> a -> b $ Loadouts -> Loadout orange Loadouts x] schema :: Schema.Schema schema :: Schema schema = String -> Value -> Schema Schema.named String "attribute-loadouts" forall a b. (a -> b) -> a -> b $ [((Key, Value), Bool)] -> Value Schema.object [ (forall value p. (ToJSON value, KeyValue p) => String -> value -> p Json.pair String "blue" forall a b. (a -> b) -> a -> b $ Schema -> Value Schema.ref Schema Loadout.schema, Bool True), (forall value p. (ToJSON value, KeyValue p) => String -> value -> p Json.pair String "orange" forall a b. (a -> b) -> a -> b $ Schema -> Value Schema.ref Schema Loadout.schema, Bool True) ] bitPut :: Loadouts -> BitPut.BitPut bitPut :: Loadouts -> BitPut bitPut Loadouts loadoutsAttribute = Loadout -> BitPut Loadout.bitPut (Loadouts -> Loadout blue Loadouts loadoutsAttribute) forall a. Semigroup a => a -> a -> a <> Loadout -> BitPut Loadout.bitPut (Loadouts -> Loadout orange Loadouts loadoutsAttribute) bitGet :: BitGet.BitGet Loadouts bitGet :: BitGet Loadouts bitGet = forall a. String -> BitGet a -> BitGet a BitGet.label String "Loadouts" forall a b. (a -> b) -> a -> b $ do Loadout blue <- forall a. String -> BitGet a -> BitGet a BitGet.label String "blue" BitGet Loadout Loadout.bitGet Loadout orange <- forall a. String -> BitGet a -> BitGet a BitGet.label String "orange" BitGet Loadout Loadout.bitGet forall (f :: * -> *) a. Applicative f => a -> f a pure Loadouts {Loadout blue :: Loadout blue :: Loadout blue, Loadout orange :: Loadout orange :: Loadout orange}