-- | Epoch
module Blockfrost.Types.Shared.Epoch where

import Data.Aeson (FromJSON, ToJSON)
import Data.Word (Word64)
import GHC.Generics
import Servant.API (Capture, FromHttpApiData (..), ToHttpApiData (..))
import Servant.Docs (DocCapture (..), ToCapture (..), ToSample (..), samples)

newtype Epoch = Epoch Integer
  deriving stock (Epoch -> Epoch -> Bool
(Epoch -> Epoch -> Bool) -> (Epoch -> Epoch -> Bool) -> Eq Epoch
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: Epoch -> Epoch -> Bool
== :: Epoch -> Epoch -> Bool
$c/= :: Epoch -> Epoch -> Bool
/= :: Epoch -> Epoch -> Bool
Eq, Eq Epoch
Eq Epoch =>
(Epoch -> Epoch -> Ordering)
-> (Epoch -> Epoch -> Bool)
-> (Epoch -> Epoch -> Bool)
-> (Epoch -> Epoch -> Bool)
-> (Epoch -> Epoch -> Bool)
-> (Epoch -> Epoch -> Epoch)
-> (Epoch -> Epoch -> Epoch)
-> Ord Epoch
Epoch -> Epoch -> Bool
Epoch -> Epoch -> Ordering
Epoch -> Epoch -> Epoch
forall a.
Eq a =>
(a -> a -> Ordering)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> a)
-> (a -> a -> a)
-> Ord a
$ccompare :: Epoch -> Epoch -> Ordering
compare :: Epoch -> Epoch -> Ordering
$c< :: Epoch -> Epoch -> Bool
< :: Epoch -> Epoch -> Bool
$c<= :: Epoch -> Epoch -> Bool
<= :: Epoch -> Epoch -> Bool
$c> :: Epoch -> Epoch -> Bool
> :: Epoch -> Epoch -> Bool
$c>= :: Epoch -> Epoch -> Bool
>= :: Epoch -> Epoch -> Bool
$cmax :: Epoch -> Epoch -> Epoch
max :: Epoch -> Epoch -> Epoch
$cmin :: Epoch -> Epoch -> Epoch
min :: Epoch -> Epoch -> Epoch
Ord, Int -> Epoch -> ShowS
[Epoch] -> ShowS
Epoch -> String
(Int -> Epoch -> ShowS)
-> (Epoch -> String) -> ([Epoch] -> ShowS) -> Show Epoch
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> Epoch -> ShowS
showsPrec :: Int -> Epoch -> ShowS
$cshow :: Epoch -> String
show :: Epoch -> String
$cshowList :: [Epoch] -> ShowS
showList :: [Epoch] -> ShowS
Show, (forall x. Epoch -> Rep Epoch x)
-> (forall x. Rep Epoch x -> Epoch) -> Generic Epoch
forall x. Rep Epoch x -> Epoch
forall x. Epoch -> Rep Epoch x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cfrom :: forall x. Epoch -> Rep Epoch x
from :: forall x. Epoch -> Rep Epoch x
$cto :: forall x. Rep Epoch x -> Epoch
to :: forall x. Rep Epoch x -> Epoch
Generic)
  deriving newtype (Integer -> Epoch
Epoch -> Epoch
Epoch -> Epoch -> Epoch
(Epoch -> Epoch -> Epoch)
-> (Epoch -> Epoch -> Epoch)
-> (Epoch -> Epoch -> Epoch)
-> (Epoch -> Epoch)
-> (Epoch -> Epoch)
-> (Epoch -> Epoch)
-> (Integer -> Epoch)
-> Num Epoch
forall a.
(a -> a -> a)
-> (a -> a -> a)
-> (a -> a -> a)
-> (a -> a)
-> (a -> a)
-> (a -> a)
-> (Integer -> a)
-> Num a
$c+ :: Epoch -> Epoch -> Epoch
+ :: Epoch -> Epoch -> Epoch
$c- :: Epoch -> Epoch -> Epoch
- :: Epoch -> Epoch -> Epoch
$c* :: Epoch -> Epoch -> Epoch
* :: Epoch -> Epoch -> Epoch
$cnegate :: Epoch -> Epoch
negate :: Epoch -> Epoch
$cabs :: Epoch -> Epoch
abs :: Epoch -> Epoch
$csignum :: Epoch -> Epoch
signum :: Epoch -> Epoch
$cfromInteger :: Integer -> Epoch
fromInteger :: Integer -> Epoch
Num, Int -> Epoch
Epoch -> Int
Epoch -> [Epoch]
Epoch -> Epoch
Epoch -> Epoch -> [Epoch]
Epoch -> Epoch -> Epoch -> [Epoch]
(Epoch -> Epoch)
-> (Epoch -> Epoch)
-> (Int -> Epoch)
-> (Epoch -> Int)
-> (Epoch -> [Epoch])
-> (Epoch -> Epoch -> [Epoch])
-> (Epoch -> Epoch -> [Epoch])
-> (Epoch -> Epoch -> Epoch -> [Epoch])
-> Enum Epoch
forall a.
(a -> a)
-> (a -> a)
-> (Int -> a)
-> (a -> Int)
-> (a -> [a])
-> (a -> a -> [a])
-> (a -> a -> [a])
-> (a -> a -> a -> [a])
-> Enum a
$csucc :: Epoch -> Epoch
succ :: Epoch -> Epoch
$cpred :: Epoch -> Epoch
pred :: Epoch -> Epoch
$ctoEnum :: Int -> Epoch
toEnum :: Int -> Epoch
$cfromEnum :: Epoch -> Int
fromEnum :: Epoch -> Int
$cenumFrom :: Epoch -> [Epoch]
enumFrom :: Epoch -> [Epoch]
$cenumFromThen :: Epoch -> Epoch -> [Epoch]
enumFromThen :: Epoch -> Epoch -> [Epoch]
$cenumFromTo :: Epoch -> Epoch -> [Epoch]
enumFromTo :: Epoch -> Epoch -> [Epoch]
$cenumFromThenTo :: Epoch -> Epoch -> Epoch -> [Epoch]
enumFromThenTo :: Epoch -> Epoch -> Epoch -> [Epoch]
Enum, Num Epoch
Ord Epoch
(Num Epoch, Ord Epoch) => (Epoch -> Rational) -> Real Epoch
Epoch -> Rational
forall a. (Num a, Ord a) => (a -> Rational) -> Real a
$ctoRational :: Epoch -> Rational
toRational :: Epoch -> Rational
Real, Enum Epoch
Real Epoch
(Real Epoch, Enum Epoch) =>
(Epoch -> Epoch -> Epoch)
-> (Epoch -> Epoch -> Epoch)
-> (Epoch -> Epoch -> Epoch)
-> (Epoch -> Epoch -> Epoch)
-> (Epoch -> Epoch -> (Epoch, Epoch))
-> (Epoch -> Epoch -> (Epoch, Epoch))
-> (Epoch -> Integer)
-> Integral Epoch
Epoch -> Integer
Epoch -> Epoch -> (Epoch, Epoch)
Epoch -> Epoch -> Epoch
forall a.
(Real a, Enum a) =>
(a -> a -> a)
-> (a -> a -> a)
-> (a -> a -> a)
-> (a -> a -> a)
-> (a -> a -> (a, a))
-> (a -> a -> (a, a))
-> (a -> Integer)
-> Integral a
$cquot :: Epoch -> Epoch -> Epoch
quot :: Epoch -> Epoch -> Epoch
$crem :: Epoch -> Epoch -> Epoch
rem :: Epoch -> Epoch -> Epoch
$cdiv :: Epoch -> Epoch -> Epoch
div :: Epoch -> Epoch -> Epoch
$cmod :: Epoch -> Epoch -> Epoch
mod :: Epoch -> Epoch -> Epoch
$cquotRem :: Epoch -> Epoch -> (Epoch, Epoch)
quotRem :: Epoch -> Epoch -> (Epoch, Epoch)
$cdivMod :: Epoch -> Epoch -> (Epoch, Epoch)
divMod :: Epoch -> Epoch -> (Epoch, Epoch)
$ctoInteger :: Epoch -> Integer
toInteger :: Epoch -> Integer
Integral, Text -> Either Text Epoch
ByteString -> Either Text Epoch
(Text -> Either Text Epoch)
-> (ByteString -> Either Text Epoch)
-> (Text -> Either Text Epoch)
-> FromHttpApiData Epoch
forall a.
(Text -> Either Text a)
-> (ByteString -> Either Text a)
-> (Text -> Either Text a)
-> FromHttpApiData a
$cparseUrlPiece :: Text -> Either Text Epoch
parseUrlPiece :: Text -> Either Text Epoch
$cparseHeader :: ByteString -> Either Text Epoch
parseHeader :: ByteString -> Either Text Epoch
$cparseQueryParam :: Text -> Either Text Epoch
parseQueryParam :: Text -> Either Text Epoch
FromHttpApiData, Epoch -> Text
Epoch -> ByteString
Epoch -> Builder
(Epoch -> Text)
-> (Epoch -> Builder)
-> (Epoch -> ByteString)
-> (Epoch -> Text)
-> (Epoch -> Builder)
-> ToHttpApiData Epoch
forall a.
(a -> Text)
-> (a -> Builder)
-> (a -> ByteString)
-> (a -> Text)
-> (a -> Builder)
-> ToHttpApiData a
$ctoUrlPiece :: Epoch -> Text
toUrlPiece :: Epoch -> Text
$ctoEncodedUrlPiece :: Epoch -> Builder
toEncodedUrlPiece :: Epoch -> Builder
$ctoHeader :: Epoch -> ByteString
toHeader :: Epoch -> ByteString
$ctoQueryParam :: Epoch -> Text
toQueryParam :: Epoch -> Text
$ctoEncodedQueryParam :: Epoch -> Builder
toEncodedQueryParam :: Epoch -> Builder
ToHttpApiData, Maybe Epoch
Value -> Parser [Epoch]
Value -> Parser Epoch
(Value -> Parser Epoch)
-> (Value -> Parser [Epoch]) -> Maybe Epoch -> FromJSON Epoch
forall a.
(Value -> Parser a)
-> (Value -> Parser [a]) -> Maybe a -> FromJSON a
$cparseJSON :: Value -> Parser Epoch
parseJSON :: Value -> Parser Epoch
$cparseJSONList :: Value -> Parser [Epoch]
parseJSONList :: Value -> Parser [Epoch]
$comittedField :: Maybe Epoch
omittedField :: Maybe Epoch
FromJSON, [Epoch] -> Value
[Epoch] -> Encoding
Epoch -> Bool
Epoch -> Value
Epoch -> Encoding
(Epoch -> Value)
-> (Epoch -> Encoding)
-> ([Epoch] -> Value)
-> ([Epoch] -> Encoding)
-> (Epoch -> Bool)
-> ToJSON Epoch
forall a.
(a -> Value)
-> (a -> Encoding)
-> ([a] -> Value)
-> ([a] -> Encoding)
-> (a -> Bool)
-> ToJSON a
$ctoJSON :: Epoch -> Value
toJSON :: Epoch -> Value
$ctoEncoding :: Epoch -> Encoding
toEncoding :: Epoch -> Encoding
$ctoJSONList :: [Epoch] -> Value
toJSONList :: [Epoch] -> Value
$ctoEncodingList :: [Epoch] -> Encoding
toEncodingList :: [Epoch] -> Encoding
$comitField :: Epoch -> Bool
omitField :: Epoch -> Bool
ToJSON)

unEpoch :: Epoch -> Integer
unEpoch :: Epoch -> Integer
unEpoch (Epoch Integer
i) = Integer
i

instance ToCapture (Capture "epoch_number" Epoch) where
  toCapture :: Proxy (Capture "epoch_number" Epoch) -> DocCapture
toCapture Proxy (Capture "epoch_number" Epoch)
_ = String -> String -> DocCapture
DocCapture String
"epoch_number" String
"Epoch for specific epoch slot."

instance ToSample Epoch where
  toSamples :: Proxy Epoch -> [(Text, Epoch)]
toSamples = [(Text, Epoch)] -> Proxy Epoch -> [(Text, Epoch)]
forall a. a -> Proxy Epoch -> a
forall (f :: * -> *) a. Applicative f => a -> f a
pure ([(Text, Epoch)] -> Proxy Epoch -> [(Text, Epoch)])
-> [(Text, Epoch)] -> Proxy Epoch -> [(Text, Epoch)]
forall a b. (a -> b) -> a -> b
$ [Epoch] -> [(Text, Epoch)]
forall a. [a] -> [(Text, a)]
samples [Epoch
425, Epoch
500, Epoch
1200]

newtype EpochLength = EpochLength Word64
  deriving stock (EpochLength -> EpochLength -> Bool
(EpochLength -> EpochLength -> Bool)
-> (EpochLength -> EpochLength -> Bool) -> Eq EpochLength
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: EpochLength -> EpochLength -> Bool
== :: EpochLength -> EpochLength -> Bool
$c/= :: EpochLength -> EpochLength -> Bool
/= :: EpochLength -> EpochLength -> Bool
Eq, Eq EpochLength
Eq EpochLength =>
(EpochLength -> EpochLength -> Ordering)
-> (EpochLength -> EpochLength -> Bool)
-> (EpochLength -> EpochLength -> Bool)
-> (EpochLength -> EpochLength -> Bool)
-> (EpochLength -> EpochLength -> Bool)
-> (EpochLength -> EpochLength -> EpochLength)
-> (EpochLength -> EpochLength -> EpochLength)
-> Ord EpochLength
EpochLength -> EpochLength -> Bool
EpochLength -> EpochLength -> Ordering
EpochLength -> EpochLength -> EpochLength
forall a.
Eq a =>
(a -> a -> Ordering)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> a)
-> (a -> a -> a)
-> Ord a
$ccompare :: EpochLength -> EpochLength -> Ordering
compare :: EpochLength -> EpochLength -> Ordering
$c< :: EpochLength -> EpochLength -> Bool
< :: EpochLength -> EpochLength -> Bool
$c<= :: EpochLength -> EpochLength -> Bool
<= :: EpochLength -> EpochLength -> Bool
$c> :: EpochLength -> EpochLength -> Bool
> :: EpochLength -> EpochLength -> Bool
$c>= :: EpochLength -> EpochLength -> Bool
>= :: EpochLength -> EpochLength -> Bool
$cmax :: EpochLength -> EpochLength -> EpochLength
max :: EpochLength -> EpochLength -> EpochLength
$cmin :: EpochLength -> EpochLength -> EpochLength
min :: EpochLength -> EpochLength -> EpochLength
Ord, Int -> EpochLength -> ShowS
[EpochLength] -> ShowS
EpochLength -> String
(Int -> EpochLength -> ShowS)
-> (EpochLength -> String)
-> ([EpochLength] -> ShowS)
-> Show EpochLength
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> EpochLength -> ShowS
showsPrec :: Int -> EpochLength -> ShowS
$cshow :: EpochLength -> String
show :: EpochLength -> String
$cshowList :: [EpochLength] -> ShowS
showList :: [EpochLength] -> ShowS
Show, (forall x. EpochLength -> Rep EpochLength x)
-> (forall x. Rep EpochLength x -> EpochLength)
-> Generic EpochLength
forall x. Rep EpochLength x -> EpochLength
forall x. EpochLength -> Rep EpochLength x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cfrom :: forall x. EpochLength -> Rep EpochLength x
from :: forall x. EpochLength -> Rep EpochLength x
$cto :: forall x. Rep EpochLength x -> EpochLength
to :: forall x. Rep EpochLength x -> EpochLength
Generic)
  deriving newtype (Integer -> EpochLength
EpochLength -> EpochLength
EpochLength -> EpochLength -> EpochLength
(EpochLength -> EpochLength -> EpochLength)
-> (EpochLength -> EpochLength -> EpochLength)
-> (EpochLength -> EpochLength -> EpochLength)
-> (EpochLength -> EpochLength)
-> (EpochLength -> EpochLength)
-> (EpochLength -> EpochLength)
-> (Integer -> EpochLength)
-> Num EpochLength
forall a.
(a -> a -> a)
-> (a -> a -> a)
-> (a -> a -> a)
-> (a -> a)
-> (a -> a)
-> (a -> a)
-> (Integer -> a)
-> Num a
$c+ :: EpochLength -> EpochLength -> EpochLength
+ :: EpochLength -> EpochLength -> EpochLength
$c- :: EpochLength -> EpochLength -> EpochLength
- :: EpochLength -> EpochLength -> EpochLength
$c* :: EpochLength -> EpochLength -> EpochLength
* :: EpochLength -> EpochLength -> EpochLength
$cnegate :: EpochLength -> EpochLength
negate :: EpochLength -> EpochLength
$cabs :: EpochLength -> EpochLength
abs :: EpochLength -> EpochLength
$csignum :: EpochLength -> EpochLength
signum :: EpochLength -> EpochLength
$cfromInteger :: Integer -> EpochLength
fromInteger :: Integer -> EpochLength
Num, Int -> EpochLength
EpochLength -> Int
EpochLength -> [EpochLength]
EpochLength -> EpochLength
EpochLength -> EpochLength -> [EpochLength]
EpochLength -> EpochLength -> EpochLength -> [EpochLength]
(EpochLength -> EpochLength)
-> (EpochLength -> EpochLength)
-> (Int -> EpochLength)
-> (EpochLength -> Int)
-> (EpochLength -> [EpochLength])
-> (EpochLength -> EpochLength -> [EpochLength])
-> (EpochLength -> EpochLength -> [EpochLength])
-> (EpochLength -> EpochLength -> EpochLength -> [EpochLength])
-> Enum EpochLength
forall a.
(a -> a)
-> (a -> a)
-> (Int -> a)
-> (a -> Int)
-> (a -> [a])
-> (a -> a -> [a])
-> (a -> a -> [a])
-> (a -> a -> a -> [a])
-> Enum a
$csucc :: EpochLength -> EpochLength
succ :: EpochLength -> EpochLength
$cpred :: EpochLength -> EpochLength
pred :: EpochLength -> EpochLength
$ctoEnum :: Int -> EpochLength
toEnum :: Int -> EpochLength
$cfromEnum :: EpochLength -> Int
fromEnum :: EpochLength -> Int
$cenumFrom :: EpochLength -> [EpochLength]
enumFrom :: EpochLength -> [EpochLength]
$cenumFromThen :: EpochLength -> EpochLength -> [EpochLength]
enumFromThen :: EpochLength -> EpochLength -> [EpochLength]
$cenumFromTo :: EpochLength -> EpochLength -> [EpochLength]
enumFromTo :: EpochLength -> EpochLength -> [EpochLength]
$cenumFromThenTo :: EpochLength -> EpochLength -> EpochLength -> [EpochLength]
enumFromThenTo :: EpochLength -> EpochLength -> EpochLength -> [EpochLength]
Enum, Num EpochLength
Ord EpochLength
(Num EpochLength, Ord EpochLength) =>
(EpochLength -> Rational) -> Real EpochLength
EpochLength -> Rational
forall a. (Num a, Ord a) => (a -> Rational) -> Real a
$ctoRational :: EpochLength -> Rational
toRational :: EpochLength -> Rational
Real, Enum EpochLength
Real EpochLength
(Real EpochLength, Enum EpochLength) =>
(EpochLength -> EpochLength -> EpochLength)
-> (EpochLength -> EpochLength -> EpochLength)
-> (EpochLength -> EpochLength -> EpochLength)
-> (EpochLength -> EpochLength -> EpochLength)
-> (EpochLength -> EpochLength -> (EpochLength, EpochLength))
-> (EpochLength -> EpochLength -> (EpochLength, EpochLength))
-> (EpochLength -> Integer)
-> Integral EpochLength
EpochLength -> Integer
EpochLength -> EpochLength -> (EpochLength, EpochLength)
EpochLength -> EpochLength -> EpochLength
forall a.
(Real a, Enum a) =>
(a -> a -> a)
-> (a -> a -> a)
-> (a -> a -> a)
-> (a -> a -> a)
-> (a -> a -> (a, a))
-> (a -> a -> (a, a))
-> (a -> Integer)
-> Integral a
$cquot :: EpochLength -> EpochLength -> EpochLength
quot :: EpochLength -> EpochLength -> EpochLength
$crem :: EpochLength -> EpochLength -> EpochLength
rem :: EpochLength -> EpochLength -> EpochLength
$cdiv :: EpochLength -> EpochLength -> EpochLength
div :: EpochLength -> EpochLength -> EpochLength
$cmod :: EpochLength -> EpochLength -> EpochLength
mod :: EpochLength -> EpochLength -> EpochLength
$cquotRem :: EpochLength -> EpochLength -> (EpochLength, EpochLength)
quotRem :: EpochLength -> EpochLength -> (EpochLength, EpochLength)
$cdivMod :: EpochLength -> EpochLength -> (EpochLength, EpochLength)
divMod :: EpochLength -> EpochLength -> (EpochLength, EpochLength)
$ctoInteger :: EpochLength -> Integer
toInteger :: EpochLength -> Integer
Integral, Text -> Either Text EpochLength
ByteString -> Either Text EpochLength
(Text -> Either Text EpochLength)
-> (ByteString -> Either Text EpochLength)
-> (Text -> Either Text EpochLength)
-> FromHttpApiData EpochLength
forall a.
(Text -> Either Text a)
-> (ByteString -> Either Text a)
-> (Text -> Either Text a)
-> FromHttpApiData a
$cparseUrlPiece :: Text -> Either Text EpochLength
parseUrlPiece :: Text -> Either Text EpochLength
$cparseHeader :: ByteString -> Either Text EpochLength
parseHeader :: ByteString -> Either Text EpochLength
$cparseQueryParam :: Text -> Either Text EpochLength
parseQueryParam :: Text -> Either Text EpochLength
FromHttpApiData, EpochLength -> Text
EpochLength -> ByteString
EpochLength -> Builder
(EpochLength -> Text)
-> (EpochLength -> Builder)
-> (EpochLength -> ByteString)
-> (EpochLength -> Text)
-> (EpochLength -> Builder)
-> ToHttpApiData EpochLength
forall a.
(a -> Text)
-> (a -> Builder)
-> (a -> ByteString)
-> (a -> Text)
-> (a -> Builder)
-> ToHttpApiData a
$ctoUrlPiece :: EpochLength -> Text
toUrlPiece :: EpochLength -> Text
$ctoEncodedUrlPiece :: EpochLength -> Builder
toEncodedUrlPiece :: EpochLength -> Builder
$ctoHeader :: EpochLength -> ByteString
toHeader :: EpochLength -> ByteString
$ctoQueryParam :: EpochLength -> Text
toQueryParam :: EpochLength -> Text
$ctoEncodedQueryParam :: EpochLength -> Builder
toEncodedQueryParam :: EpochLength -> Builder
ToHttpApiData, Maybe EpochLength
Value -> Parser [EpochLength]
Value -> Parser EpochLength
(Value -> Parser EpochLength)
-> (Value -> Parser [EpochLength])
-> Maybe EpochLength
-> FromJSON EpochLength
forall a.
(Value -> Parser a)
-> (Value -> Parser [a]) -> Maybe a -> FromJSON a
$cparseJSON :: Value -> Parser EpochLength
parseJSON :: Value -> Parser EpochLength
$cparseJSONList :: Value -> Parser [EpochLength]
parseJSONList :: Value -> Parser [EpochLength]
$comittedField :: Maybe EpochLength
omittedField :: Maybe EpochLength
FromJSON, [EpochLength] -> Value
[EpochLength] -> Encoding
EpochLength -> Bool
EpochLength -> Value
EpochLength -> Encoding
(EpochLength -> Value)
-> (EpochLength -> Encoding)
-> ([EpochLength] -> Value)
-> ([EpochLength] -> Encoding)
-> (EpochLength -> Bool)
-> ToJSON EpochLength
forall a.
(a -> Value)
-> (a -> Encoding)
-> ([a] -> Value)
-> ([a] -> Encoding)
-> (a -> Bool)
-> ToJSON a
$ctoJSON :: EpochLength -> Value
toJSON :: EpochLength -> Value
$ctoEncoding :: EpochLength -> Encoding
toEncoding :: EpochLength -> Encoding
$ctoJSONList :: [EpochLength] -> Value
toJSONList :: [EpochLength] -> Value
$ctoEncodingList :: [EpochLength] -> Encoding
toEncodingList :: [EpochLength] -> Encoding
$comitField :: EpochLength -> Bool
omitField :: EpochLength -> Bool
ToJSON)

unEpochLength :: EpochLength -> Word64
unEpochLength :: EpochLength -> Word64
unEpochLength (EpochLength Word64
u) = Word64
u

instance ToCapture (Capture "epoch_length" EpochLength) where
  toCapture :: Proxy (Capture "epoch_length" EpochLength) -> DocCapture
toCapture Proxy (Capture "epoch_length" EpochLength)
_ = String -> String -> DocCapture
DocCapture String
"epoch_length" String
"Epoch size in a specific Cardano era."

instance ToSample EpochLength where
  toSamples :: Proxy EpochLength -> [(Text, EpochLength)]
toSamples = [(Text, EpochLength)] -> Proxy EpochLength -> [(Text, EpochLength)]
forall a. a -> Proxy EpochLength -> a
forall (f :: * -> *) a. Applicative f => a -> f a
pure ([(Text, EpochLength)]
 -> Proxy EpochLength -> [(Text, EpochLength)])
-> [(Text, EpochLength)]
-> Proxy EpochLength
-> [(Text, EpochLength)]
forall a b. (a -> b) -> a -> b
$ [EpochLength] -> [(Text, EpochLength)]
forall a. [a] -> [(Text, a)]
samples [EpochLength
21600, EpochLength
86400, EpochLength
432000]