{-# OPTIONS_GHC -Wno-orphans #-}

-- Mirrors the equivalent V1 module in plutus-ledger-api
module Plutarch.LedgerApi.V1.Address (
  PAddress (..),
) where

import GHC.Generics (Generic)
import Plutarch.LedgerApi.Utils (PMaybeData)
import Plutarch.LedgerApi.V1.Credential (PCredential, PStakingCredential)
import Plutarch.Prelude
import PlutusLedgerApi.V1 qualified as Plutus

-- | @since 2.0.0
newtype PAddress (s :: S)
  = PAddress
      ( Term
          s
          ( PDataRecord
              '[ "credential" ':= PCredential
               , "stakingCredential" ':= PMaybeData PStakingCredential
               ]
          )
      )
  deriving stock
    ( -- | @since 2.0.0
      (forall x. PAddress s -> Rep (PAddress s) x)
-> (forall x. Rep (PAddress s) x -> PAddress s)
-> Generic (PAddress s)
forall x. Rep (PAddress s) x -> PAddress s
forall x. PAddress s -> Rep (PAddress s) x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
forall (s :: S) x. Rep (PAddress s) x -> PAddress s
forall (s :: S) x. PAddress s -> Rep (PAddress s) x
$cfrom :: forall (s :: S) x. PAddress s -> Rep (PAddress s) x
from :: forall x. PAddress s -> Rep (PAddress s) x
$cto :: forall (s :: S) x. Rep (PAddress s) x -> PAddress s
to :: forall x. Rep (PAddress s) x -> PAddress s
Generic
    )
  deriving anyclass
    ( -- | @since 2.0.0
      (forall (s :: S). PAddress s -> Term s (PInner PAddress))
-> (forall (s :: S) (b :: PType).
    Term s (PInner PAddress) -> (PAddress s -> Term s b) -> Term s b)
-> PlutusType PAddress
forall (s :: S). PAddress s -> Term s (PInner PAddress)
forall (s :: S) (b :: PType).
Term s (PInner PAddress) -> (PAddress s -> Term s b) -> Term s b
forall (a :: PType).
(forall (s :: S). a s -> Term s (PInner a))
-> (forall (s :: S) (b :: PType).
    Term s (PInner a) -> (a s -> Term s b) -> Term s b)
-> PlutusType a
$cpcon' :: forall (s :: S). PAddress s -> Term s (PInner PAddress)
pcon' :: forall (s :: S). PAddress s -> Term s (PInner PAddress)
$cpmatch' :: forall (s :: S) (b :: PType).
Term s (PInner PAddress) -> (PAddress s -> Term s b) -> Term s b
pmatch' :: forall (s :: S) (b :: PType).
Term s (PInner PAddress) -> (PAddress s -> Term s b) -> Term s b
PlutusType
    , -- | @since 2.0.0
      (forall (s :: S). Term s (PAsData PAddress) -> Term s PAddress)
-> (forall (s :: S). Term s PAddress -> Term s PData)
-> PIsData PAddress
forall (s :: S). Term s (PAsData PAddress) -> Term s PAddress
forall (s :: S). Term s PAddress -> Term s PData
forall (a :: PType).
(forall (s :: S). Term s (PAsData a) -> Term s a)
-> (forall (s :: S). Term s a -> Term s PData) -> PIsData a
$cpfromDataImpl :: forall (s :: S). Term s (PAsData PAddress) -> Term s PAddress
pfromDataImpl :: forall (s :: S). Term s (PAsData PAddress) -> Term s PAddress
$cpdataImpl :: forall (s :: S). Term s PAddress -> Term s PData
pdataImpl :: forall (s :: S). Term s PAddress -> Term s PData
PIsData
    , -- | @since 2.0.0
      (forall (s :: S).
 Term s PAddress -> Term s (PDataRecord (PFields PAddress)))
-> PDataFields PAddress
forall (s :: S).
Term s PAddress -> Term s (PDataRecord (PFields PAddress))
forall (a :: PType).
(forall (s :: S). Term s a -> Term s (PDataRecord (PFields a)))
-> PDataFields a
$cptoFields :: forall (s :: S).
Term s PAddress -> Term s (PDataRecord (PFields PAddress))
ptoFields :: forall (s :: S).
Term s PAddress -> Term s (PDataRecord (PFields PAddress))
PDataFields
    , -- | @since 2.0.0
      (forall (s :: S).
 Term s PAddress -> Term s PAddress -> Term s PBool)
-> PEq PAddress
forall (s :: S). Term s PAddress -> Term s PAddress -> Term s PBool
forall (t :: PType).
(forall (s :: S). Term s t -> Term s t -> Term s PBool) -> PEq t
$c#== :: forall (s :: S). Term s PAddress -> Term s PAddress -> Term s PBool
#== :: forall (s :: S). Term s PAddress -> Term s PAddress -> Term s PBool
PEq
    , -- | @since 2.0.0
      PEq PAddress
PEq PAddress =>
(forall (s :: S).
 Term s PAddress -> Term s PAddress -> Term s PBool)
-> (forall (s :: S).
    Term s PAddress -> Term s PAddress -> Term s PBool)
-> (forall (s :: S).
    Term s PAddress -> Term s PAddress -> Term s PAddress)
-> (forall (s :: S).
    Term s PAddress -> Term s PAddress -> Term s PAddress)
-> POrd PAddress
forall (s :: S). Term s PAddress -> Term s PAddress -> Term s PBool
forall (s :: S).
Term s PAddress -> Term s PAddress -> Term s PAddress
forall (t :: PType).
PEq t =>
(forall (s :: S). Term s t -> Term s t -> Term s PBool)
-> (forall (s :: S). Term s t -> Term s t -> Term s PBool)
-> (forall (s :: S). Term s t -> Term s t -> Term s t)
-> (forall (s :: S). Term s t -> Term s t -> Term s t)
-> POrd t
$c#<= :: forall (s :: S). Term s PAddress -> Term s PAddress -> Term s PBool
#<= :: forall (s :: S). Term s PAddress -> Term s PAddress -> Term s PBool
$c#< :: forall (s :: S). Term s PAddress -> Term s PAddress -> Term s PBool
#< :: forall (s :: S). Term s PAddress -> Term s PAddress -> Term s PBool
$cpmax :: forall (s :: S).
Term s PAddress -> Term s PAddress -> Term s PAddress
pmax :: forall (s :: S).
Term s PAddress -> Term s PAddress -> Term s PAddress
$cpmin :: forall (s :: S).
Term s PAddress -> Term s PAddress -> Term s PAddress
pmin :: forall (s :: S).
Term s PAddress -> Term s PAddress -> Term s PAddress
POrd
    , -- | @since 2.0.0
      (forall (s :: S). Bool -> Term s PAddress -> Term s PString)
-> PShow PAddress
forall (s :: S). Bool -> Term s PAddress -> Term s PString
forall (t :: PType).
(forall (s :: S). Bool -> Term s t -> Term s PString) -> PShow t
$cpshow' :: forall (s :: S). Bool -> Term s PAddress -> Term s PString
pshow' :: forall (s :: S). Bool -> Term s PAddress -> Term s PString
PShow
    , -- | @since 2.0.0
      PTryFrom PData
    )

-- | @since 2.0.0
instance DerivePlutusType PAddress where
  type DPTStrat _ = PlutusTypeData

-- | @since WIP
deriving via
  DeriveDataPLiftable PAddress Plutus.Address
  instance
    PLiftable PAddress

-- | @since 2.0.0
instance PTryFrom PData (PAsData PAddress)