{-# LANGUAGE DerivingStrategies #-}
{-# LANGUAGE GeneralizedNewtypeDeriving #-}

module Hercules.API.Labels where

import Control.Lens ((?~))
import Data.Aeson (Value)
import Data.Function ((&))
import Data.Swagger
import Hercules.API.Prelude

newtype Labels = Labels {Labels -> Map Text Value
fromLabels :: Map Text Value}
  deriving newtype (Int -> Labels -> ShowS
[Labels] -> ShowS
Labels -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Labels] -> ShowS
$cshowList :: [Labels] -> ShowS
show :: Labels -> String
$cshow :: Labels -> String
showsPrec :: Int -> Labels -> ShowS
$cshowsPrec :: Int -> Labels -> ShowS
Show, Labels -> Labels -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Labels -> Labels -> Bool
$c/= :: Labels -> Labels -> Bool
== :: Labels -> Labels -> Bool
$c== :: Labels -> Labels -> Bool
Eq, Labels -> ()
forall a. (a -> ()) -> NFData a
rnf :: Labels -> ()
$crnf :: Labels -> ()
NFData, [Labels] -> Encoding
[Labels] -> Value
Labels -> Encoding
Labels -> Value
forall a.
(a -> Value)
-> (a -> Encoding)
-> ([a] -> Value)
-> ([a] -> Encoding)
-> ToJSON a
toEncodingList :: [Labels] -> Encoding
$ctoEncodingList :: [Labels] -> Encoding
toJSONList :: [Labels] -> Value
$ctoJSONList :: [Labels] -> Value
toEncoding :: Labels -> Encoding
$ctoEncoding :: Labels -> Encoding
toJSON :: Labels -> Value
$ctoJSON :: Labels -> Value
ToJSON, Value -> Parser [Labels]
Value -> Parser Labels
forall a.
(Value -> Parser a) -> (Value -> Parser [a]) -> FromJSON a
parseJSONList :: Value -> Parser [Labels]
$cparseJSONList :: Value -> Parser [Labels]
parseJSON :: Value -> Parser Labels
$cparseJSON :: Value -> Parser Labels
FromJSON)

instance ToSchema Labels where
  declareNamedSchema :: Proxy Labels -> Declare (Definitions Schema) NamedSchema
declareNamedSchema Proxy Labels
_p = do
    forall (m :: * -> *) a. Monad m => a -> m a
return forall a b. (a -> b) -> a -> b
$
      Maybe Text -> Schema -> NamedSchema
NamedSchema (forall a. a -> Maybe a
Just Text
"Labels") forall a b. (a -> b) -> a -> b
$
        forall a. Monoid a => a
mempty
          forall a b. a -> (a -> b) -> b
& forall s a. HasType s a => Lens' s a
type_ forall s t a b. ASetter s t a (Maybe b) -> b -> s -> t
?~ SwaggerType 'SwaggerKindSchema
SwaggerObject
          forall a b. a -> (a -> b) -> b
& forall s a. HasAdditionalProperties s a => Lens' s a
additionalProperties forall s t a b. ASetter s t a (Maybe b) -> b -> s -> t
?~ Bool -> AdditionalProperties
AdditionalPropertiesAllowed Bool
True