{-# LANGUAGE DataKinds #-}
{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE DerivingVia #-}
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE FlexibleInstances #-}
{-# LANGUAGE GeneralizedNewtypeDeriving #-}
{-# LANGUAGE MultiParamTypeClasses #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE RecordWildCards #-}
{-# LANGUAGE ScopedTypeVariables #-}
{-# LANGUAGE StandaloneDeriving #-}
{-# LANGUAGE TypeApplications #-}
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE TypeOperators #-}
{-# LANGUAGE UndecidableInstances #-}
{-# OPTIONS_GHC -Wno-orphans #-}

module Cardano.Ledger.CanonicalState.Namespace.GovCommittee.V0 (
  GovCommitteeIn (..),
  GovCommitteeOut (..),
  CanonicalCommitteeState (..),
  CanonicalCommitteeAuthorization (..),
  mkCanonicalCommitteeAuthorization,
  fromCanonicalCommitteeAuthorization,
) where

import Cardano.Ledger.BaseTypes (Anchor (..), EpochNo (..), StrictMaybe (..))
import Cardano.Ledger.CanonicalState.BasicTypes ()
import Cardano.Ledger.CanonicalState.Namespace (Era, NamespaceEra)
import Cardano.Ledger.Credential (Credential (..))
import Cardano.Ledger.Keys (KeyRole (ColdCommitteeRole, HotCommitteeRole))
import Cardano.Ledger.State (CommitteeAuthorization (..))
import Cardano.SCLS.CBOR.Canonical.Decoder (FromCanonicalCBOR (..), decodeListLenCanonicalOf)
import Cardano.SCLS.CBOR.Canonical.Encoder (ToCanonicalCBOR (..))
import Cardano.SCLS.Entry.IsKey (IsKey (..))
import Cardano.SCLS.NamespaceCodec (
  CanonicalCBOREntryDecoder (..),
  CanonicalCBOREntryEncoder (..),
  KnownNamespace (..),
  namespaceKeySize,
 )
import Cardano.SCLS.Versioned (Versioned (..))
import qualified Data.Map.Strict as Map
import Data.MemPack.ByteOrdered (packWord64beM, unpackBigEndianM)
import Data.Proxy (Proxy (..))
import Data.Word (Word8)
import GHC.Generics (Generic)

instance (Era era, NamespaceEra "gov/committee/v0" ~ era) => KnownNamespace "gov/committee/v0" where
  type NamespaceKey "gov/committee/v0" = GovCommitteeIn
  type NamespaceEntry "gov/committee/v0" = GovCommitteeOut

instance
  (Era era, NamespaceEra "gov/committee/v0" ~ era) =>
  CanonicalCBOREntryEncoder "gov/committee/v0" GovCommitteeOut
  where
  encodeEntry :: GovCommitteeOut -> CanonicalEncoding
encodeEntry (GovCommitteeOut CanonicalCommitteeState
n) = Proxy "gov/committee/v0"
-> CanonicalCommitteeState -> CanonicalEncoding
forall (v :: Symbol) a (proxy :: Symbol -> *).
ToCanonicalCBOR v a =>
proxy v -> a -> CanonicalEncoding
forall (proxy :: Symbol -> *).
proxy "gov/committee/v0"
-> CanonicalCommitteeState -> CanonicalEncoding
toCanonicalCBOR (forall {k} (t :: k). Proxy t
forall (t :: Symbol). Proxy t
Proxy @"gov/committee/v0") CanonicalCommitteeState
n

instance
  (Era era, NamespaceEra "gov/committee/v0" ~ era) =>
  CanonicalCBOREntryDecoder "gov/committee/v0" GovCommitteeOut
  where
  decodeEntry :: forall s.
CanonicalDecoder s (Versioned "gov/committee/v0" GovCommitteeOut)
decodeEntry = (CanonicalCommitteeState -> GovCommitteeOut)
-> Versioned "gov/committee/v0" CanonicalCommitteeState
-> Versioned "gov/committee/v0" GovCommitteeOut
forall a b.
(a -> b)
-> Versioned "gov/committee/v0" a -> Versioned "gov/committee/v0" b
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap CanonicalCommitteeState -> GovCommitteeOut
GovCommitteeOut (Versioned "gov/committee/v0" CanonicalCommitteeState
 -> Versioned "gov/committee/v0" GovCommitteeOut)
-> CanonicalDecoder
     s (Versioned "gov/committee/v0" CanonicalCommitteeState)
-> CanonicalDecoder
     s (Versioned "gov/committee/v0" GovCommitteeOut)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> CanonicalDecoder
  s (Versioned "gov/committee/v0" CanonicalCommitteeState)
forall s.
CanonicalDecoder
  s (Versioned "gov/committee/v0" CanonicalCommitteeState)
forall (v :: Symbol) a s.
FromCanonicalCBOR v a =>
CanonicalDecoder s (Versioned v a)
fromCanonicalCBOR

data GovCommitteeIn = GovCommitteeIn EpochNo
  deriving (GovCommitteeIn -> GovCommitteeIn -> Bool
(GovCommitteeIn -> GovCommitteeIn -> Bool)
-> (GovCommitteeIn -> GovCommitteeIn -> Bool) -> Eq GovCommitteeIn
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: GovCommitteeIn -> GovCommitteeIn -> Bool
== :: GovCommitteeIn -> GovCommitteeIn -> Bool
$c/= :: GovCommitteeIn -> GovCommitteeIn -> Bool
/= :: GovCommitteeIn -> GovCommitteeIn -> Bool
Eq, Eq GovCommitteeIn
Eq GovCommitteeIn =>
(GovCommitteeIn -> GovCommitteeIn -> Ordering)
-> (GovCommitteeIn -> GovCommitteeIn -> Bool)
-> (GovCommitteeIn -> GovCommitteeIn -> Bool)
-> (GovCommitteeIn -> GovCommitteeIn -> Bool)
-> (GovCommitteeIn -> GovCommitteeIn -> Bool)
-> (GovCommitteeIn -> GovCommitteeIn -> GovCommitteeIn)
-> (GovCommitteeIn -> GovCommitteeIn -> GovCommitteeIn)
-> Ord GovCommitteeIn
GovCommitteeIn -> GovCommitteeIn -> Bool
GovCommitteeIn -> GovCommitteeIn -> Ordering
GovCommitteeIn -> GovCommitteeIn -> GovCommitteeIn
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 :: GovCommitteeIn -> GovCommitteeIn -> Ordering
compare :: GovCommitteeIn -> GovCommitteeIn -> Ordering
$c< :: GovCommitteeIn -> GovCommitteeIn -> Bool
< :: GovCommitteeIn -> GovCommitteeIn -> Bool
$c<= :: GovCommitteeIn -> GovCommitteeIn -> Bool
<= :: GovCommitteeIn -> GovCommitteeIn -> Bool
$c> :: GovCommitteeIn -> GovCommitteeIn -> Bool
> :: GovCommitteeIn -> GovCommitteeIn -> Bool
$c>= :: GovCommitteeIn -> GovCommitteeIn -> Bool
>= :: GovCommitteeIn -> GovCommitteeIn -> Bool
$cmax :: GovCommitteeIn -> GovCommitteeIn -> GovCommitteeIn
max :: GovCommitteeIn -> GovCommitteeIn -> GovCommitteeIn
$cmin :: GovCommitteeIn -> GovCommitteeIn -> GovCommitteeIn
min :: GovCommitteeIn -> GovCommitteeIn -> GovCommitteeIn
Ord, Int -> GovCommitteeIn -> ShowS
[GovCommitteeIn] -> ShowS
GovCommitteeIn -> String
(Int -> GovCommitteeIn -> ShowS)
-> (GovCommitteeIn -> String)
-> ([GovCommitteeIn] -> ShowS)
-> Show GovCommitteeIn
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> GovCommitteeIn -> ShowS
showsPrec :: Int -> GovCommitteeIn -> ShowS
$cshow :: GovCommitteeIn -> String
show :: GovCommitteeIn -> String
$cshowList :: [GovCommitteeIn] -> ShowS
showList :: [GovCommitteeIn] -> ShowS
Show)

newtype GovCommitteeOut = GovCommitteeOut CanonicalCommitteeState
  deriving (GovCommitteeOut -> GovCommitteeOut -> Bool
(GovCommitteeOut -> GovCommitteeOut -> Bool)
-> (GovCommitteeOut -> GovCommitteeOut -> Bool)
-> Eq GovCommitteeOut
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: GovCommitteeOut -> GovCommitteeOut -> Bool
== :: GovCommitteeOut -> GovCommitteeOut -> Bool
$c/= :: GovCommitteeOut -> GovCommitteeOut -> Bool
/= :: GovCommitteeOut -> GovCommitteeOut -> Bool
Eq, Int -> GovCommitteeOut -> ShowS
[GovCommitteeOut] -> ShowS
GovCommitteeOut -> String
(Int -> GovCommitteeOut -> ShowS)
-> (GovCommitteeOut -> String)
-> ([GovCommitteeOut] -> ShowS)
-> Show GovCommitteeOut
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> GovCommitteeOut -> ShowS
showsPrec :: Int -> GovCommitteeOut -> ShowS
$cshow :: GovCommitteeOut -> String
show :: GovCommitteeOut -> String
$cshowList :: [GovCommitteeOut] -> ShowS
showList :: [GovCommitteeOut] -> ShowS
Show, (forall x. GovCommitteeOut -> Rep GovCommitteeOut x)
-> (forall x. Rep GovCommitteeOut x -> GovCommitteeOut)
-> Generic GovCommitteeOut
forall x. Rep GovCommitteeOut x -> GovCommitteeOut
forall x. GovCommitteeOut -> Rep GovCommitteeOut x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cfrom :: forall x. GovCommitteeOut -> Rep GovCommitteeOut x
from :: forall x. GovCommitteeOut -> Rep GovCommitteeOut x
$cto :: forall x. Rep GovCommitteeOut x -> GovCommitteeOut
to :: forall x. Rep GovCommitteeOut x -> GovCommitteeOut
Generic)

instance IsKey GovCommitteeIn where
  keySize :: Int
keySize = forall (ns :: Symbol). KnownNat (NamespaceKeySize ns) => Int
namespaceKeySize @"gov/committee/v0"
  packKeyM :: forall b. GovCommitteeIn -> Pack b ()
packKeyM (GovCommitteeIn (EpochNo Word64
no)) = do
    Word64 -> Pack b ()
forall s. Word64 -> Pack s ()
packWord64beM Word64
no
  unpackKeyM :: forall b s. Buffer b => Unpack' s b GovCommitteeIn
unpackKeyM = do
    no <- Unpack s b Word64
forall a b s. (Bytes a, MemPack a, Buffer b) => Unpack s b a
unpackBigEndianM
    return $ GovCommitteeIn (EpochNo no)

newtype CanonicalCommitteeState = CanonicalCommitteeState
  { CanonicalCommitteeState
-> Map
     (Credential ColdCommitteeRole) CanonicalCommitteeAuthorization
csCommitteeCreds :: Map.Map (Credential ColdCommitteeRole) CanonicalCommitteeAuthorization
  }
  deriving (CanonicalCommitteeState -> CanonicalCommitteeState -> Bool
(CanonicalCommitteeState -> CanonicalCommitteeState -> Bool)
-> (CanonicalCommitteeState -> CanonicalCommitteeState -> Bool)
-> Eq CanonicalCommitteeState
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: CanonicalCommitteeState -> CanonicalCommitteeState -> Bool
== :: CanonicalCommitteeState -> CanonicalCommitteeState -> Bool
$c/= :: CanonicalCommitteeState -> CanonicalCommitteeState -> Bool
/= :: CanonicalCommitteeState -> CanonicalCommitteeState -> Bool
Eq, Int -> CanonicalCommitteeState -> ShowS
[CanonicalCommitteeState] -> ShowS
CanonicalCommitteeState -> String
(Int -> CanonicalCommitteeState -> ShowS)
-> (CanonicalCommitteeState -> String)
-> ([CanonicalCommitteeState] -> ShowS)
-> Show CanonicalCommitteeState
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> CanonicalCommitteeState -> ShowS
showsPrec :: Int -> CanonicalCommitteeState -> ShowS
$cshow :: CanonicalCommitteeState -> String
show :: CanonicalCommitteeState -> String
$cshowList :: [CanonicalCommitteeState] -> ShowS
showList :: [CanonicalCommitteeState] -> ShowS
Show, (forall x.
 CanonicalCommitteeState -> Rep CanonicalCommitteeState x)
-> (forall x.
    Rep CanonicalCommitteeState x -> CanonicalCommitteeState)
-> Generic CanonicalCommitteeState
forall x. Rep CanonicalCommitteeState x -> CanonicalCommitteeState
forall x. CanonicalCommitteeState -> Rep CanonicalCommitteeState x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cfrom :: forall x. CanonicalCommitteeState -> Rep CanonicalCommitteeState x
from :: forall x. CanonicalCommitteeState -> Rep CanonicalCommitteeState x
$cto :: forall x. Rep CanonicalCommitteeState x -> CanonicalCommitteeState
to :: forall x. Rep CanonicalCommitteeState x -> CanonicalCommitteeState
Generic)

instance (Era era, NamespaceEra v ~ era) => ToCanonicalCBOR v CanonicalCommitteeState where
  toCanonicalCBOR :: forall (proxy :: Symbol -> *).
proxy v -> CanonicalCommitteeState -> CanonicalEncoding
toCanonicalCBOR proxy v
v CanonicalCommitteeState {Map (Credential ColdCommitteeRole) CanonicalCommitteeAuthorization
csCommitteeCreds :: CanonicalCommitteeState
-> Map
     (Credential ColdCommitteeRole) CanonicalCommitteeAuthorization
csCommitteeCreds :: Map (Credential ColdCommitteeRole) CanonicalCommitteeAuthorization
..} = proxy v
-> Map
     (Credential ColdCommitteeRole) CanonicalCommitteeAuthorization
-> CanonicalEncoding
forall (v :: Symbol) a (proxy :: Symbol -> *).
ToCanonicalCBOR v a =>
proxy v -> a -> CanonicalEncoding
forall (proxy :: Symbol -> *).
proxy v
-> Map
     (Credential ColdCommitteeRole) CanonicalCommitteeAuthorization
-> CanonicalEncoding
toCanonicalCBOR proxy v
v Map (Credential ColdCommitteeRole) CanonicalCommitteeAuthorization
csCommitteeCreds

instance (Era era, NamespaceEra v ~ era) => FromCanonicalCBOR v CanonicalCommitteeState where
  fromCanonicalCBOR :: forall s. CanonicalDecoder s (Versioned v CanonicalCommitteeState)
fromCanonicalCBOR = do
    st_ <- CanonicalDecoder
  s
  (Versioned
     v
     (Map
        (Credential ColdCommitteeRole) CanonicalCommitteeAuthorization))
forall s.
CanonicalDecoder
  s
  (Versioned
     v
     (Map
        (Credential ColdCommitteeRole) CanonicalCommitteeAuthorization))
forall (v :: Symbol) a s.
FromCanonicalCBOR v a =>
CanonicalDecoder s (Versioned v a)
fromCanonicalCBOR
    return $ CanonicalCommitteeState <$> st_

instance (Era era, NamespaceEra v ~ era) => ToCanonicalCBOR v CanonicalCommitteeAuthorization where
  toCanonicalCBOR :: forall (proxy :: Symbol -> *).
proxy v -> CanonicalCommitteeAuthorization -> CanonicalEncoding
toCanonicalCBOR proxy v
v (CanonicalCommitteeHotCredential Credential HotCommitteeRole
cred) =
    proxy v
-> (Word8, Credential HotCommitteeRole) -> CanonicalEncoding
forall (v :: Symbol) a (proxy :: Symbol -> *).
ToCanonicalCBOR v a =>
proxy v -> a -> CanonicalEncoding
forall (proxy :: Symbol -> *).
proxy v
-> (Word8, Credential HotCommitteeRole) -> CanonicalEncoding
toCanonicalCBOR proxy v
v (Word8
0 :: Word8, Credential HotCommitteeRole
cred)
  toCanonicalCBOR proxy v
v (CanonicalCommitteeMemberResigned StrictMaybe Anchor
ma) =
    proxy v -> (Word8, StrictMaybe Anchor) -> CanonicalEncoding
forall (v :: Symbol) a (proxy :: Symbol -> *).
ToCanonicalCBOR v a =>
proxy v -> a -> CanonicalEncoding
forall (proxy :: Symbol -> *).
proxy v -> (Word8, StrictMaybe Anchor) -> CanonicalEncoding
toCanonicalCBOR proxy v
v (Word8
1 :: Word8, StrictMaybe Anchor
ma)

instance (Era era, NamespaceEra v ~ era) => FromCanonicalCBOR v CanonicalCommitteeAuthorization where
  fromCanonicalCBOR :: forall s.
CanonicalDecoder s (Versioned v CanonicalCommitteeAuthorization)
fromCanonicalCBOR = do
    Int -> CanonicalDecoder s ()
forall s. Int -> CanonicalDecoder s ()
decodeListLenCanonicalOf Int
2
    Versioned (tag :: Word8) <- CanonicalDecoder s (Versioned (ZonkAny 0) Word8)
forall s. CanonicalDecoder s (Versioned (ZonkAny 0) Word8)
forall (v :: Symbol) a s.
FromCanonicalCBOR v a =>
CanonicalDecoder s (Versioned v a)
fromCanonicalCBOR
    case tag of
      Word8
0 -> (Credential HotCommitteeRole -> CanonicalCommitteeAuthorization)
-> Versioned v (Credential HotCommitteeRole)
-> Versioned v CanonicalCommitteeAuthorization
forall a b. (a -> b) -> Versioned v a -> Versioned v b
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap Credential HotCommitteeRole -> CanonicalCommitteeAuthorization
CanonicalCommitteeHotCredential (Versioned v (Credential HotCommitteeRole)
 -> Versioned v CanonicalCommitteeAuthorization)
-> CanonicalDecoder s (Versioned v (Credential HotCommitteeRole))
-> CanonicalDecoder s (Versioned v CanonicalCommitteeAuthorization)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> forall (v :: Symbol) a s.
FromCanonicalCBOR v a =>
CanonicalDecoder s (Versioned v a)
fromCanonicalCBOR @v
      Word8
1 -> (StrictMaybe Anchor -> CanonicalCommitteeAuthorization)
-> Versioned v (StrictMaybe Anchor)
-> Versioned v CanonicalCommitteeAuthorization
forall a b. (a -> b) -> Versioned v a -> Versioned v b
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap StrictMaybe Anchor -> CanonicalCommitteeAuthorization
CanonicalCommitteeMemberResigned (Versioned v (StrictMaybe Anchor)
 -> Versioned v CanonicalCommitteeAuthorization)
-> CanonicalDecoder s (Versioned v (StrictMaybe Anchor))
-> CanonicalDecoder s (Versioned v CanonicalCommitteeAuthorization)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> forall (v :: Symbol) a s.
FromCanonicalCBOR v a =>
CanonicalDecoder s (Versioned v a)
fromCanonicalCBOR @v
      Word8
_ -> String
-> CanonicalDecoder s (Versioned v CanonicalCommitteeAuthorization)
forall a. String -> CanonicalDecoder s a
forall (m :: * -> *) a. MonadFail m => String -> m a
fail String
"Invalid CommitteeAuthorization tag"

data CanonicalCommitteeAuthorization
  = CanonicalCommitteeHotCredential (Credential HotCommitteeRole)
  | CanonicalCommitteeMemberResigned (StrictMaybe Anchor)
  deriving (CanonicalCommitteeAuthorization
-> CanonicalCommitteeAuthorization -> Bool
(CanonicalCommitteeAuthorization
 -> CanonicalCommitteeAuthorization -> Bool)
-> (CanonicalCommitteeAuthorization
    -> CanonicalCommitteeAuthorization -> Bool)
-> Eq CanonicalCommitteeAuthorization
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: CanonicalCommitteeAuthorization
-> CanonicalCommitteeAuthorization -> Bool
== :: CanonicalCommitteeAuthorization
-> CanonicalCommitteeAuthorization -> Bool
$c/= :: CanonicalCommitteeAuthorization
-> CanonicalCommitteeAuthorization -> Bool
/= :: CanonicalCommitteeAuthorization
-> CanonicalCommitteeAuthorization -> Bool
Eq, Int -> CanonicalCommitteeAuthorization -> ShowS
[CanonicalCommitteeAuthorization] -> ShowS
CanonicalCommitteeAuthorization -> String
(Int -> CanonicalCommitteeAuthorization -> ShowS)
-> (CanonicalCommitteeAuthorization -> String)
-> ([CanonicalCommitteeAuthorization] -> ShowS)
-> Show CanonicalCommitteeAuthorization
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> CanonicalCommitteeAuthorization -> ShowS
showsPrec :: Int -> CanonicalCommitteeAuthorization -> ShowS
$cshow :: CanonicalCommitteeAuthorization -> String
show :: CanonicalCommitteeAuthorization -> String
$cshowList :: [CanonicalCommitteeAuthorization] -> ShowS
showList :: [CanonicalCommitteeAuthorization] -> ShowS
Show, Eq CanonicalCommitteeAuthorization
Eq CanonicalCommitteeAuthorization =>
(CanonicalCommitteeAuthorization
 -> CanonicalCommitteeAuthorization -> Ordering)
-> (CanonicalCommitteeAuthorization
    -> CanonicalCommitteeAuthorization -> Bool)
-> (CanonicalCommitteeAuthorization
    -> CanonicalCommitteeAuthorization -> Bool)
-> (CanonicalCommitteeAuthorization
    -> CanonicalCommitteeAuthorization -> Bool)
-> (CanonicalCommitteeAuthorization
    -> CanonicalCommitteeAuthorization -> Bool)
-> (CanonicalCommitteeAuthorization
    -> CanonicalCommitteeAuthorization
    -> CanonicalCommitteeAuthorization)
-> (CanonicalCommitteeAuthorization
    -> CanonicalCommitteeAuthorization
    -> CanonicalCommitteeAuthorization)
-> Ord CanonicalCommitteeAuthorization
CanonicalCommitteeAuthorization
-> CanonicalCommitteeAuthorization -> Bool
CanonicalCommitteeAuthorization
-> CanonicalCommitteeAuthorization -> Ordering
CanonicalCommitteeAuthorization
-> CanonicalCommitteeAuthorization
-> CanonicalCommitteeAuthorization
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 :: CanonicalCommitteeAuthorization
-> CanonicalCommitteeAuthorization -> Ordering
compare :: CanonicalCommitteeAuthorization
-> CanonicalCommitteeAuthorization -> Ordering
$c< :: CanonicalCommitteeAuthorization
-> CanonicalCommitteeAuthorization -> Bool
< :: CanonicalCommitteeAuthorization
-> CanonicalCommitteeAuthorization -> Bool
$c<= :: CanonicalCommitteeAuthorization
-> CanonicalCommitteeAuthorization -> Bool
<= :: CanonicalCommitteeAuthorization
-> CanonicalCommitteeAuthorization -> Bool
$c> :: CanonicalCommitteeAuthorization
-> CanonicalCommitteeAuthorization -> Bool
> :: CanonicalCommitteeAuthorization
-> CanonicalCommitteeAuthorization -> Bool
$c>= :: CanonicalCommitteeAuthorization
-> CanonicalCommitteeAuthorization -> Bool
>= :: CanonicalCommitteeAuthorization
-> CanonicalCommitteeAuthorization -> Bool
$cmax :: CanonicalCommitteeAuthorization
-> CanonicalCommitteeAuthorization
-> CanonicalCommitteeAuthorization
max :: CanonicalCommitteeAuthorization
-> CanonicalCommitteeAuthorization
-> CanonicalCommitteeAuthorization
$cmin :: CanonicalCommitteeAuthorization
-> CanonicalCommitteeAuthorization
-> CanonicalCommitteeAuthorization
min :: CanonicalCommitteeAuthorization
-> CanonicalCommitteeAuthorization
-> CanonicalCommitteeAuthorization
Ord, (forall x.
 CanonicalCommitteeAuthorization
 -> Rep CanonicalCommitteeAuthorization x)
-> (forall x.
    Rep CanonicalCommitteeAuthorization x
    -> CanonicalCommitteeAuthorization)
-> Generic CanonicalCommitteeAuthorization
forall x.
Rep CanonicalCommitteeAuthorization x
-> CanonicalCommitteeAuthorization
forall x.
CanonicalCommitteeAuthorization
-> Rep CanonicalCommitteeAuthorization x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cfrom :: forall x.
CanonicalCommitteeAuthorization
-> Rep CanonicalCommitteeAuthorization x
from :: forall x.
CanonicalCommitteeAuthorization
-> Rep CanonicalCommitteeAuthorization x
$cto :: forall x.
Rep CanonicalCommitteeAuthorization x
-> CanonicalCommitteeAuthorization
to :: forall x.
Rep CanonicalCommitteeAuthorization x
-> CanonicalCommitteeAuthorization
Generic)

mkCanonicalCommitteeAuthorization :: CommitteeAuthorization -> CanonicalCommitteeAuthorization
mkCanonicalCommitteeAuthorization :: CommitteeAuthorization -> CanonicalCommitteeAuthorization
mkCanonicalCommitteeAuthorization (CommitteeHotCredential Credential HotCommitteeRole
credential) = Credential HotCommitteeRole -> CanonicalCommitteeAuthorization
CanonicalCommitteeHotCredential Credential HotCommitteeRole
credential
mkCanonicalCommitteeAuthorization (CommitteeMemberResigned StrictMaybe Anchor
anchor) = StrictMaybe Anchor -> CanonicalCommitteeAuthorization
CanonicalCommitteeMemberResigned StrictMaybe Anchor
anchor

fromCanonicalCommitteeAuthorization :: CanonicalCommitteeAuthorization -> CommitteeAuthorization
fromCanonicalCommitteeAuthorization :: CanonicalCommitteeAuthorization -> CommitteeAuthorization
fromCanonicalCommitteeAuthorization (CanonicalCommitteeHotCredential Credential HotCommitteeRole
credential) = Credential HotCommitteeRole -> CommitteeAuthorization
CommitteeHotCredential Credential HotCommitteeRole
credential
fromCanonicalCommitteeAuthorization (CanonicalCommitteeMemberResigned StrictMaybe Anchor
anchor) = StrictMaybe Anchor -> CommitteeAuthorization
CommitteeMemberResigned StrictMaybe Anchor
anchor