{-# LANGUAGE DeriveAnyClass #-}

module Hercules.API.BillingStatus
  ( BillingStatus (..),
    toText,
    fromText,
  )
where

import Data.Swagger
import Hercules.API.Prelude

data BillingStatus
  = Community -- Free plan
  | Trial
  | Active
  | Cancelled
  | External
  | Enterprise
  deriving (forall x. Rep BillingStatus x -> BillingStatus
forall x. BillingStatus -> Rep BillingStatus x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep BillingStatus x -> BillingStatus
$cfrom :: forall x. BillingStatus -> Rep BillingStatus x
Generic, Int -> BillingStatus -> ShowS
[BillingStatus] -> ShowS
BillingStatus -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [BillingStatus] -> ShowS
$cshowList :: [BillingStatus] -> ShowS
show :: BillingStatus -> String
$cshow :: BillingStatus -> String
showsPrec :: Int -> BillingStatus -> ShowS
$cshowsPrec :: Int -> BillingStatus -> ShowS
Show, BillingStatus -> BillingStatus -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: BillingStatus -> BillingStatus -> Bool
$c/= :: BillingStatus -> BillingStatus -> Bool
== :: BillingStatus -> BillingStatus -> Bool
$c== :: BillingStatus -> BillingStatus -> Bool
Eq, BillingStatus -> ()
forall a. (a -> ()) -> NFData a
rnf :: BillingStatus -> ()
$crnf :: BillingStatus -> ()
NFData, [BillingStatus] -> Encoding
[BillingStatus] -> Value
BillingStatus -> Encoding
BillingStatus -> Value
forall a.
(a -> Value)
-> (a -> Encoding)
-> ([a] -> Value)
-> ([a] -> Encoding)
-> ToJSON a
toEncodingList :: [BillingStatus] -> Encoding
$ctoEncodingList :: [BillingStatus] -> Encoding
toJSONList :: [BillingStatus] -> Value
$ctoJSONList :: [BillingStatus] -> Value
toEncoding :: BillingStatus -> Encoding
$ctoEncoding :: BillingStatus -> Encoding
toJSON :: BillingStatus -> Value
$ctoJSON :: BillingStatus -> Value
ToJSON, Value -> Parser [BillingStatus]
Value -> Parser BillingStatus
forall a.
(Value -> Parser a) -> (Value -> Parser [a]) -> FromJSON a
parseJSONList :: Value -> Parser [BillingStatus]
$cparseJSONList :: Value -> Parser [BillingStatus]
parseJSON :: Value -> Parser BillingStatus
$cparseJSON :: Value -> Parser BillingStatus
FromJSON, Proxy BillingStatus -> Declare (Definitions Schema) NamedSchema
forall a.
(Proxy a -> Declare (Definitions Schema) NamedSchema) -> ToSchema a
declareNamedSchema :: Proxy BillingStatus -> Declare (Definitions Schema) NamedSchema
$cdeclareNamedSchema :: Proxy BillingStatus -> Declare (Definitions Schema) NamedSchema
ToSchema)

toText :: BillingStatus -> Text
toText :: BillingStatus -> Text
toText BillingStatus
Community = Text
"Community"
toText BillingStatus
Trial = Text
"Trial"
toText BillingStatus
Active = Text
"Active"
toText BillingStatus
Cancelled = Text
"Cancelled"
toText BillingStatus
External = Text
"External"
toText BillingStatus
Enterprise = Text
"Enterprise"

fromText :: Text -> Maybe BillingStatus
fromText :: Text -> Maybe BillingStatus
fromText Text
"Community" = forall a. a -> Maybe a
Just BillingStatus
Community
fromText Text
"Cancelled" = forall a. a -> Maybe a
Just BillingStatus
Cancelled
fromText Text
"Trial" = forall a. a -> Maybe a
Just BillingStatus
Trial
fromText Text
"Active" = forall a. a -> Maybe a
Just BillingStatus
Active
fromText Text
"External" = forall a. a -> Maybe a
Just BillingStatus
External
fromText Text
"Enterprise" = forall a. a -> Maybe a
Just BillingStatus
Enterprise
fromText Text
_ = forall a. Maybe a
Nothing