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

module Cardano.Ledger.CanonicalState.Namespace.GovConstitution.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| Constitution record entry
        |
        | ```
        | meta:
        |   endian: be
        |
        | seq:
        |   - id: key
        |     type: gov_constitution
        |
        | types:
        |   gov_constitution:
        |     seq:
        |       - id: singleton
        |         doc: singleton key with value 0
        |         type: u1
        |.        valid: 0
        | ```
        |]
    (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
constitution

constitution :: Rule
constitution :: Rule
constitution =
  Comment -> Rule -> Rule
forall a. HasComment a => Comment -> a -> a
comment
    Comment
[str| address of the constitution
        |]
    (Rule -> Rule) -> Rule -> Rule
forall a b. (a -> b) -> a -> b
$ Name
"constitution"
      Name -> ArrayChoice -> Rule
forall a. IsType0 a => Name -> a -> Rule
=:= ArrayChoice -> ArrayChoice
arr
        [ Rule -> ArrayEntry
forall a e. (IsType0 a, IsGroupOrArrayEntry e) => a -> e
a Rule
anchor
        , Choice Type2 -> ArrayEntry
forall a e. (IsType0 a, IsGroupOrArrayEntry e) => a -> e
a (Rule
script_hash Rule -> Value Void -> Choice Type2
forall a c b.
(IsChoosable a c, IsChoosable b c) =>
a -> b -> Choice c
/ Value Void
VNil)
        ]