{-# LANGUAGE ImportQualifiedPost #-}
{-# LANGUAGE OverloadedLists #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE QuasiQuotes #-}
{-# LANGUAGE TypeApplications #-}
{-# LANGUAGE NoImplicitPrelude #-}
{-# OPTIONS_GHC -Wno-unrecognised-pragmas #-}

{-# HLINT ignore "Use camelCase" #-}
module Cardano.Ledger.CanonicalState.Namespace.EntitiesStakePools.V0.CDDL where

import Cardano.Ledger.CanonicalState.Namespace.CDDL.Common
import Codec.CBOR.Cuddle.Huddle
import Data.Function (($))
import Text.Heredoc (str)

record_entry :: Rule
record_entry :: Rule
record_entry =
  Comment -> Rule -> Rule
forall a. HasComment a => Comment -> a -> a
comment
    Comment
[str| The key for the namespace
        |
        | ```
        | meta:
        |   endian: be
        |
        | seq:
        |   - id: key
        |     type: keyhash
        |
        | types:
        |   keyhash:
        |     seq:
        |       - id: keyhash_data
        |         size: 28
        | ```
        |]
    (Rule -> Rule) -> Rule -> Rule
forall a b. (a -> b) -> a -> b
$ Name
"record_entry" Name -> Rule -> Rule
forall a. IsType0 a => Name -> a -> Rule
=:= Rule
stake_pool

stake_pool :: Rule
stake_pool :: Rule
stake_pool =
  Name
"stake_pool"
    Name -> MapChoice -> Rule
forall a. IsType0 a => Name -> a -> Rule
=:= MapChoice -> MapChoice
mp
      [ Key
"stake_pool_state" Key -> Choice Type2 -> MapEntry
forall a me. (IsType0 a, IsEntryLike me) => Key -> a -> me
==> Rule
stake_pool_state Rule -> Value Void -> Choice Type2
forall a c b.
(IsChoosable a c, IsChoosable b c) =>
a -> b -> Choice c
/ Value Void
VNil
      , Key
"retiring_epoch_no" Key -> Choice Type2 -> MapEntry
forall a me. (IsType0 a, IsEntryLike me) => Key -> a -> me
==> Rule
epoch_no Rule -> Value Void -> Choice Type2
forall a c b.
(IsChoosable a c, IsChoosable b c) =>
a -> b -> Choice c
/ Value Void
VNil
      , Key
"future_stake_pool_params" Key -> Choice Type2 -> MapEntry
forall a me. (IsType0 a, IsEntryLike me) => Key -> a -> me
==> Rule
stake_pool_params Rule -> Value Void -> Choice Type2
forall a c b.
(IsChoosable a c, IsChoosable b c) =>
a -> b -> Choice c
/ Value Void
VNil
      ]

stake_pool_state :: Rule
stake_pool_state :: Rule
stake_pool_state =
  Name
"stake_pool_state"
    Name -> MapChoice -> Rule
forall a. IsType0 a => Name -> a -> Rule
=:= MapChoice -> MapChoice
mp
      [ Key
"vrf" Key -> Rule -> MapEntry
forall a me. (IsType0 a, IsEntryLike me) => Key -> a -> me
==> Rule
vrf_keyhash
      , Key
"cost" Key -> Rule -> MapEntry
forall a me. (IsType0 a, IsEntryLike me) => Key -> a -> me
==> Rule
coin
      , Key
"margin" Key -> Rule -> MapEntry
forall a me. (IsType0 a, IsEntryLike me) => Key -> a -> me
==> Rule
unit_interval
      , Key
"owners" Key -> GRuleCall -> MapEntry
forall a me. (IsType0 a, IsEntryLike me) => Key -> a -> me
==> Rule -> GRuleCall
forall t0. IsType0 t0 => t0 -> GRuleCall
set Rule
staking_keyhash
      , Key
"pledge" Key -> Rule -> MapEntry
forall a me. (IsType0 a, IsEntryLike me) => Key -> a -> me
==> Rule
coin
      , Key
"relays" Key -> ArrayChoice -> MapEntry
forall a me. (IsType0 a, IsEntryLike me) => Key -> a -> me
==> ArrayChoice -> ArrayChoice
arr [Word64
0 Word64 -> ArrayEntry -> ArrayEntry
forall a. CanQuantify a => Word64 -> a -> a
<+ Rule -> ArrayEntry
forall a e. (IsType0 a, IsGroupOrArrayEntry e) => a -> e
a Rule
relay]
      , Key
"deposit" Key -> Rule -> MapEntry
forall a me. (IsType0 a, IsEntryLike me) => Key -> a -> me
==> Rule
coin
      , Key
"metadata" Key -> Choice Type2 -> MapEntry
forall a me. (IsType0 a, IsEntryLike me) => Key -> a -> me
==> Rule
pool_metadata Rule -> Value Void -> Choice Type2
forall a c b.
(IsChoosable a c, IsChoosable b c) =>
a -> b -> Choice c
/ Value Void
VNil
      , Key
"bls_key" Key -> Choice Type2 -> MapEntry
forall a me. (IsType0 a, IsEntryLike me) => Key -> a -> me
==> Rule
bls_key_rule Rule -> Value Void -> Choice Type2
forall a c b.
(IsChoosable a c, IsChoosable b c) =>
a -> b -> Choice c
/ Value Void
VNil
      , Key
"account_id" Key -> Rule -> MapEntry
forall a me. (IsType0 a, IsEntryLike me) => Key -> a -> me
==> Rule
account_id
      , Key
"delegators" Key -> GRuleCall -> MapEntry
forall a me. (IsType0 a, IsEntryLike me) => Key -> a -> me
==> Rule -> GRuleCall
forall t0. IsType0 t0 => t0 -> GRuleCall
set Rule
credential
      ]

stake_pool_params :: Rule
stake_pool_params :: Rule
stake_pool_params =
  Name
"stake_pool_params"
    Name -> MapChoice -> Rule
forall a. IsType0 a => Name -> a -> Rule
=:= MapChoice -> MapChoice
mp
      [ Key
"id" Key -> Rule -> MapEntry
forall a me. (IsType0 a, IsEntryLike me) => Key -> a -> me
==> Rule
pool_keyhash
      , Key
"vrf" Key -> Rule -> MapEntry
forall a me. (IsType0 a, IsEntryLike me) => Key -> a -> me
==> Rule
vrf_keyhash
      , Key
"bls_key" Key -> Choice Type2 -> MapEntry
forall a me. (IsType0 a, IsEntryLike me) => Key -> a -> me
==> Rule
bls_key_rule Rule -> Value Void -> Choice Type2
forall a c b.
(IsChoosable a c, IsChoosable b c) =>
a -> b -> Choice c
/ Value Void
VNil
      , Key
"cost" Key -> Rule -> MapEntry
forall a me. (IsType0 a, IsEntryLike me) => Key -> a -> me
==> Rule
coin
      , Key
"margin" Key -> Rule -> MapEntry
forall a me. (IsType0 a, IsEntryLike me) => Key -> a -> me
==> Rule
unit_interval
      , Key
"owners" Key -> GRuleCall -> MapEntry
forall a me. (IsType0 a, IsEntryLike me) => Key -> a -> me
==> Rule -> GRuleCall
forall t0. IsType0 t0 => t0 -> GRuleCall
set Rule
staking_keyhash
      , Key
"pledge" Key -> Rule -> MapEntry
forall a me. (IsType0 a, IsEntryLike me) => Key -> a -> me
==> Rule
coin
      , Key
"relays" Key -> ArrayChoice -> MapEntry
forall a me. (IsType0 a, IsEntryLike me) => Key -> a -> me
==> ArrayChoice -> ArrayChoice
arr [Word64
0 Word64 -> ArrayEntry -> ArrayEntry
forall a. CanQuantify a => Word64 -> a -> a
<+ Rule -> ArrayEntry
forall a e. (IsType0 a, IsGroupOrArrayEntry e) => a -> e
a Rule
relay]
      , Key
"metadata" Key -> Choice Type2 -> MapEntry
forall a me. (IsType0 a, IsEntryLike me) => Key -> a -> me
==> Rule
pool_metadata Rule -> Value Void -> Choice Type2
forall a c b.
(IsChoosable a c, IsChoosable b c) =>
a -> b -> Choice c
/ Value Void
VNil
      , Key
"account_address" Key -> Rule -> MapEntry
forall a me. (IsType0 a, IsEntryLike me) => Key -> a -> me
==> Rule
address
      ]

bls_key_rule :: Rule
bls_key_rule :: Rule
bls_key_rule = Name
"bls_key" Name -> ArrayChoice -> Rule
forall a. IsType0 a => Name -> a -> Rule
=:= ArrayChoice -> ArrayChoice
arr [Value ByteString -> ArrayEntry
forall a e. (IsType0 a, IsGroupOrArrayEntry e) => a -> e
a Value ByteString
VBytes, Value ByteString -> ArrayEntry
forall a e. (IsType0 a, IsGroupOrArrayEntry e) => a -> e
a Value ByteString
VBytes]