# miden::standards::access::pausable::manager
#
# Pause admin manager. Exposes `pause` and `unpause` as `Invocation: call` procedures gated by
# the account-wide `Authority` component via `exec.authority::assert_authorized` — the same
# pattern that `TokenPolicyManager::set_*_policy` uses. This makes a single PausableManager
# work uniformly with `Authority::OwnerControlled` (Ownable2Step owner), `Authority::AuthControlled`
# (account auth scheme), and `Authority::RbacControlled { role }` (a single role gates both
# pause and unpause).
#
# Companion components required on the account:
# - `Authority` — provides the auth dispatch the body calls into.
# - `Pausable` — provides the `is_paused` storage slot that pause / unpause write to.

use miden::standards::access::authority
use miden::standards::access::pausable

# PUBLIC INTERFACE
# ================================================================================================

#! Pause the account.
#!
#! Inputs:  [pad(16)]
#! Outputs: [pad(16)]
#!
#! Panics if:
#! - the caller is not authorized per the installed `Authority` component.
#!
#! Invocation: call
pub proc pause
    exec.authority::assert_authorized
    # => [pad(16)]

    exec.pausable::pause
    # => [pad(16)]
end

#! Unpause the account.
#!
#! Inputs:  [pad(16)]
#! Outputs: [pad(16)]
#!
#! Panics if:
#! - the caller is not authorized per the installed `Authority` component.
#!
#! Invocation: call
pub proc unpause
    exec.authority::assert_authorized
    # => [pad(16)]

    exec.pausable::unpause
    # => [pad(16)]
end
