//! Generated by `trust-tasks-codegen` — do not edit by hand.
//!
//! Spec slug: `persona/profile/delete`. Version: `1.0`.
/// Why this specification version is deprecated (SPEC "Superseded and
/// Withdrawn Versions"), or `None` while it is current.
pub const DEPRECATION: Option<&str> = None;
#[allow(unused_imports)]
use serde::{Deserialize, Serialize};
/// Error types.
pub mod error {
/// Error from a `TryFrom` or `FromStr` implementation.
pub struct ConversionError(::std::borrow::Cow<'static, str>);
impl ::std::error::Error for ConversionError {}
impl ::std::fmt::Display for ConversionError {
fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> Result<(), ::std::fmt::Error> {
::std::fmt::Display::fmt(&self.0, f)
}
}
impl ::std::fmt::Debug for ConversionError {
fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> Result<(), ::std::fmt::Error> {
::std::fmt::Debug::fmt(&self.0, f)
}
}
impl From<&'static str> for ConversionError {
fn from(value: &'static str) -> Self {
Self(value.into())
}
}
impl From<String> for ConversionError {
fn from(value: String) -> Self {
Self(value.into())
}
}
}
///Optimistic-concurrency precondition. A positive value requires the record's current `version` to equal it exactly; zero means create-only and applies only when no live record exists at the address.
///
#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
#[serde(transparent)]
pub struct ExpectedVersion(pub u64);
impl ::std::ops::Deref for ExpectedVersion {
type Target = u64;
fn deref(&self) -> &u64 {
&self.0
}
}
impl ::std::convert::From<ExpectedVersion> for u64 {
fn from(value: ExpectedVersion) -> Self {
value.0
}
}
impl ::std::convert::From<u64> for ExpectedVersion {
fn from(value: u64) -> Self {
Self(value)
}
}
impl ::std::str::FromStr for ExpectedVersion {
type Err = <u64 as ::std::str::FromStr>::Err;
fn from_str(value: &str) -> ::std::result::Result<Self, Self::Err> {
Ok(Self(value.parse()?))
}
}
impl ::std::convert::TryFrom<&str> for ExpectedVersion {
type Error = <u64 as ::std::str::FromStr>::Err;
fn try_from(value: &str) -> ::std::result::Result<Self, Self::Error> {
value.parse()
}
}
impl ::std::convert::TryFrom<String> for ExpectedVersion {
type Error = <u64 as ::std::str::FromStr>::Err;
fn try_from(value: String) -> ::std::result::Result<Self, Self::Error> {
value.parse()
}
}
impl ::std::fmt::Display for ExpectedVersion {
fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
self.0.fmt(f)
}
}
///Vendor-namespaced extension object per SPEC.md §4.5.1. Each immediate key MUST be a reverse-DNS namespace; structure under each namespace is opaque to the framework.
///
#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
#[serde(transparent)]
pub struct Ext(pub ::std::collections::HashMap<ExtKey, ::serde_json::Value>);
impl ::std::ops::Deref for Ext {
type Target = ::std::collections::HashMap<ExtKey, ::serde_json::Value>;
fn deref(&self) -> &::std::collections::HashMap<ExtKey, ::serde_json::Value> {
&self.0
}
}
impl ::std::convert::From<Ext> for ::std::collections::HashMap<ExtKey, ::serde_json::Value> {
fn from(value: Ext) -> Self {
value.0
}
}
impl ::std::convert::From<::std::collections::HashMap<ExtKey, ::serde_json::Value>> for Ext {
fn from(value: ::std::collections::HashMap<ExtKey, ::serde_json::Value>) -> Self {
Self(value)
}
}
///`ExtKey`
///
#[derive(::serde::Serialize, Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
#[serde(transparent)]
pub struct ExtKey(::std::string::String);
impl ::std::ops::Deref for ExtKey {
type Target = ::std::string::String;
fn deref(&self) -> &::std::string::String {
&self.0
}
}
impl ::std::convert::From<ExtKey> for ::std::string::String {
fn from(value: ExtKey) -> Self {
value.0
}
}
impl ::std::str::FromStr for ExtKey {
type Err = self::error::ConversionError;
fn from_str(value: &str) -> ::std::result::Result<Self, self::error::ConversionError> {
static PATTERN: ::std::sync::LazyLock<::regress::Regex> =
::std::sync::LazyLock::new(|| {
::regress::Regex::new("^[a-z][a-z0-9-]*(\\.[a-z0-9-]+)+$").unwrap()
});
if PATTERN.find(value).is_none() {
return Err("doesn't match pattern \"^[a-z][a-z0-9-]*(\\.[a-z0-9-]+)+$\"".into());
}
Ok(Self(value.to_string()))
}
}
impl ::std::convert::TryFrom<&str> for ExtKey {
type Error = self::error::ConversionError;
fn try_from(value: &str) -> ::std::result::Result<Self, self::error::ConversionError> {
value.parse()
}
}
impl ::std::convert::TryFrom<&::std::string::String> for ExtKey {
type Error = self::error::ConversionError;
fn try_from(
value: &::std::string::String,
) -> ::std::result::Result<Self, self::error::ConversionError> {
value.parse()
}
}
impl ::std::convert::TryFrom<::std::string::String> for ExtKey {
type Error = self::error::ConversionError;
fn try_from(
value: ::std::string::String,
) -> ::std::result::Result<Self, self::error::ConversionError> {
value.parse()
}
}
impl<'de> ::serde::Deserialize<'de> for ExtKey {
fn deserialize<D>(deserializer: D) -> ::std::result::Result<Self, D::Error>
where
D: ::serde::Deserializer<'de>,
{
::std::string::String::deserialize(deserializer)?
.parse()
.map_err(|e: self::error::ConversionError| {
<D::Error as ::serde::de::Error>::custom(e.to_string())
})
}
}
///Remove one profile. Refused by default while a persona is still bound to it, because a bound persona whose profile vanished would present nothing without the holder having said so.
///
#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
#[serde(deny_unknown_fields)]
#[non_exhaustive]
pub struct Payload {
#[serde(
rename = "expectedVersion",
default,
skip_serializing_if = "::std::option::Option::is_none"
)]
pub expected_version: ::std::option::Option<ExpectedVersion>,
#[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
pub ext: ::std::option::Option<Ext>,
#[serde(rename = "profileId")]
pub profile_id: Ulid,
///When false (the default) a bound profile is refused and the error names the bound personas. When true the profile is removed and every binding to it is cleared, leaving those personas with no profile — which is a legal state, and one the holder is told about rather than discovering. Never the default: a persona that silently stopped presenting anything is a failure a holder finds out about from the other side.
#[serde(default)]
pub unbind: bool,
}
impl Payload {
pub fn builder() -> builder::Payload {
Default::default()
}
}
///Success response to persona/profile/delete. Type https://trusttasks.org/spec/persona/profile/delete/1.0#response. Deleting an absent profile is a success carrying existed: false, which is what makes a repeated delete converge.
///
#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
#[serde(deny_unknown_fields)]
#[non_exhaustive]
pub struct Response {
#[serde(
rename = "disclosedTo",
default,
skip_serializing_if = "::std::option::Option::is_none"
)]
pub disclosed_to: ::std::option::Option<ResponseDisclosedTo>,
///False when no live profile was present. A repeat delete returns false and deliberately takes no new version, so watchers never observe a change that did not happen.
pub existed: bool,
#[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
pub ext: ::std::option::Option<Ext>,
#[serde(rename = "profileId")]
pub profile_id: Ulid,
///Persona DIDs whose bindings were cleared. Present only when `unbind` was true and something was cleared — a holder is owed the list of which personas their one action left presenting nothing.
#[serde(
rename = "unboundPersonas",
default,
skip_serializing_if = "::std::vec::Vec::is_empty"
)]
pub unbound_personas: ::std::vec::Vec<ResponseUnboundPersonasItem>,
}
impl Response {
pub fn builder() -> builder::Response {
Default::default()
}
}
///How many distinct parties this face has disclosed to, across how many contexts, from the holder's disclosure history. Counts, not identifiers; persona/disclosure/history names them. Returned on the delete because the delete does not un-tell anyone: the history, and what those parties hold, remain.
///
#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
#[serde(deny_unknown_fields)]
#[non_exhaustive]
pub struct ResponseDisclosedTo {
#[serde(rename = "contextCount")]
pub context_count: u64,
#[serde(rename = "partyCount")]
pub party_count: u64,
}
impl ResponseDisclosedTo {
pub fn builder() -> builder::ResponseDisclosedTo {
Default::default()
}
}
///`ResponseUnboundPersonasItem`
///
#[derive(::serde::Serialize, Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
#[serde(transparent)]
pub struct ResponseUnboundPersonasItem(::std::string::String);
impl ::std::ops::Deref for ResponseUnboundPersonasItem {
type Target = ::std::string::String;
fn deref(&self) -> &::std::string::String {
&self.0
}
}
impl ::std::convert::From<ResponseUnboundPersonasItem> for ::std::string::String {
fn from(value: ResponseUnboundPersonasItem) -> Self {
value.0
}
}
impl ::std::str::FromStr for ResponseUnboundPersonasItem {
type Err = self::error::ConversionError;
fn from_str(value: &str) -> ::std::result::Result<Self, self::error::ConversionError> {
if value.chars().count() < 1usize {
return Err("shorter than 1 characters".into());
}
Ok(Self(value.to_string()))
}
}
impl ::std::convert::TryFrom<&str> for ResponseUnboundPersonasItem {
type Error = self::error::ConversionError;
fn try_from(value: &str) -> ::std::result::Result<Self, self::error::ConversionError> {
value.parse()
}
}
impl ::std::convert::TryFrom<&::std::string::String> for ResponseUnboundPersonasItem {
type Error = self::error::ConversionError;
fn try_from(
value: &::std::string::String,
) -> ::std::result::Result<Self, self::error::ConversionError> {
value.parse()
}
}
impl ::std::convert::TryFrom<::std::string::String> for ResponseUnboundPersonasItem {
type Error = self::error::ConversionError;
fn try_from(
value: ::std::string::String,
) -> ::std::result::Result<Self, self::error::ConversionError> {
value.parse()
}
}
impl<'de> ::serde::Deserialize<'de> for ResponseUnboundPersonasItem {
fn deserialize<D>(deserializer: D) -> ::std::result::Result<Self, D::Error>
where
D: ::serde::Deserializer<'de>,
{
::std::string::String::deserialize(deserializer)?
.parse()
.map_err(|e: self::error::ConversionError| {
<D::Error as ::serde::de::Error>::custom(e.to_string())
})
}
}
///A ULID in Crockford base32, uppercase. Used for `attributeId` and `profileId`. Chosen over a UUID because the leading 48 bits are a timestamp, so a key-ordered scan of the store is also creation-ordered and a `list` needs no secondary sort. Server-assigned on create; a producer MAY supply one to make a create idempotent, and a maintainer MUST reject a supplied value that already exists rather than silently overwriting.
///
#[derive(::serde::Serialize, Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
#[serde(transparent)]
pub struct Ulid(::std::string::String);
impl ::std::ops::Deref for Ulid {
type Target = ::std::string::String;
fn deref(&self) -> &::std::string::String {
&self.0
}
}
impl ::std::convert::From<Ulid> for ::std::string::String {
fn from(value: Ulid) -> Self {
value.0
}
}
impl ::std::str::FromStr for Ulid {
type Err = self::error::ConversionError;
fn from_str(value: &str) -> ::std::result::Result<Self, self::error::ConversionError> {
static PATTERN: ::std::sync::LazyLock<::regress::Regex> =
::std::sync::LazyLock::new(|| {
::regress::Regex::new("^[0-9A-HJKMNP-TV-Z]{26}$").unwrap()
});
if PATTERN.find(value).is_none() {
return Err("doesn't match pattern \"^[0-9A-HJKMNP-TV-Z]{26}$\"".into());
}
Ok(Self(value.to_string()))
}
}
impl ::std::convert::TryFrom<&str> for Ulid {
type Error = self::error::ConversionError;
fn try_from(value: &str) -> ::std::result::Result<Self, self::error::ConversionError> {
value.parse()
}
}
impl ::std::convert::TryFrom<&::std::string::String> for Ulid {
type Error = self::error::ConversionError;
fn try_from(
value: &::std::string::String,
) -> ::std::result::Result<Self, self::error::ConversionError> {
value.parse()
}
}
impl ::std::convert::TryFrom<::std::string::String> for Ulid {
type Error = self::error::ConversionError;
fn try_from(
value: ::std::string::String,
) -> ::std::result::Result<Self, self::error::ConversionError> {
value.parse()
}
}
impl<'de> ::serde::Deserialize<'de> for Ulid {
fn deserialize<D>(deserializer: D) -> ::std::result::Result<Self, D::Error>
where
D: ::serde::Deserializer<'de>,
{
::std::string::String::deserialize(deserializer)?
.parse()
.map_err(|e: self::error::ConversionError| {
<D::Error as ::serde::de::Error>::custom(e.to_string())
})
}
}
/// Types for composing complex structures.
pub mod builder {
#[derive(Clone, Debug)]
pub struct Payload {
expected_version: ::std::result::Result<
::std::option::Option<super::ExpectedVersion>,
::std::string::String,
>,
ext: ::std::result::Result<::std::option::Option<super::Ext>, ::std::string::String>,
profile_id: ::std::result::Result<super::Ulid, ::std::string::String>,
unbind: ::std::result::Result<bool, ::std::string::String>,
}
impl ::std::default::Default for Payload {
fn default() -> Self {
Self {
expected_version: Ok(Default::default()),
ext: Ok(Default::default()),
profile_id: Err("no value supplied for profile_id".to_string()),
unbind: Ok(Default::default()),
}
}
}
impl Payload {
pub fn expected_version<T>(mut self, value: T) -> Self
where
T: ::std::convert::TryInto<::std::option::Option<super::ExpectedVersion>>,
T::Error: ::std::fmt::Display,
{
self.expected_version = value
.try_into()
.map_err(|e| format!("error converting supplied value for expected_version: {e}"));
self
}
pub fn ext<T>(mut self, value: T) -> Self
where
T: ::std::convert::TryInto<::std::option::Option<super::Ext>>,
T::Error: ::std::fmt::Display,
{
self.ext = value
.try_into()
.map_err(|e| format!("error converting supplied value for ext: {e}"));
self
}
pub fn profile_id<T>(mut self, value: T) -> Self
where
T: ::std::convert::TryInto<super::Ulid>,
T::Error: ::std::fmt::Display,
{
self.profile_id = value
.try_into()
.map_err(|e| format!("error converting supplied value for profile_id: {e}"));
self
}
pub fn unbind<T>(mut self, value: T) -> Self
where
T: ::std::convert::TryInto<bool>,
T::Error: ::std::fmt::Display,
{
self.unbind = value
.try_into()
.map_err(|e| format!("error converting supplied value for unbind: {e}"));
self
}
}
impl ::std::convert::TryFrom<Payload> for super::Payload {
type Error = super::error::ConversionError;
fn try_from(value: Payload) -> ::std::result::Result<Self, super::error::ConversionError> {
Ok(Self {
expected_version: value.expected_version?,
ext: value.ext?,
profile_id: value.profile_id?,
unbind: value.unbind?,
})
}
}
impl ::std::convert::From<super::Payload> for Payload {
fn from(value: super::Payload) -> Self {
Self {
expected_version: Ok(value.expected_version),
ext: Ok(value.ext),
profile_id: Ok(value.profile_id),
unbind: Ok(value.unbind),
}
}
}
#[derive(Clone, Debug)]
pub struct Response {
disclosed_to: ::std::result::Result<
::std::option::Option<super::ResponseDisclosedTo>,
::std::string::String,
>,
existed: ::std::result::Result<bool, ::std::string::String>,
ext: ::std::result::Result<::std::option::Option<super::Ext>, ::std::string::String>,
profile_id: ::std::result::Result<super::Ulid, ::std::string::String>,
unbound_personas: ::std::result::Result<
::std::vec::Vec<super::ResponseUnboundPersonasItem>,
::std::string::String,
>,
}
impl ::std::default::Default for Response {
fn default() -> Self {
Self {
disclosed_to: Ok(Default::default()),
existed: Err("no value supplied for existed".to_string()),
ext: Ok(Default::default()),
profile_id: Err("no value supplied for profile_id".to_string()),
unbound_personas: Ok(Default::default()),
}
}
}
impl Response {
pub fn disclosed_to<T>(mut self, value: T) -> Self
where
T: ::std::convert::TryInto<::std::option::Option<super::ResponseDisclosedTo>>,
T::Error: ::std::fmt::Display,
{
self.disclosed_to = value
.try_into()
.map_err(|e| format!("error converting supplied value for disclosed_to: {e}"));
self
}
pub fn existed<T>(mut self, value: T) -> Self
where
T: ::std::convert::TryInto<bool>,
T::Error: ::std::fmt::Display,
{
self.existed = value
.try_into()
.map_err(|e| format!("error converting supplied value for existed: {e}"));
self
}
pub fn ext<T>(mut self, value: T) -> Self
where
T: ::std::convert::TryInto<::std::option::Option<super::Ext>>,
T::Error: ::std::fmt::Display,
{
self.ext = value
.try_into()
.map_err(|e| format!("error converting supplied value for ext: {e}"));
self
}
pub fn profile_id<T>(mut self, value: T) -> Self
where
T: ::std::convert::TryInto<super::Ulid>,
T::Error: ::std::fmt::Display,
{
self.profile_id = value
.try_into()
.map_err(|e| format!("error converting supplied value for profile_id: {e}"));
self
}
pub fn unbound_personas<T>(mut self, value: T) -> Self
where
T: ::std::convert::TryInto<::std::vec::Vec<super::ResponseUnboundPersonasItem>>,
T::Error: ::std::fmt::Display,
{
self.unbound_personas = value
.try_into()
.map_err(|e| format!("error converting supplied value for unbound_personas: {e}"));
self
}
}
impl ::std::convert::TryFrom<Response> for super::Response {
type Error = super::error::ConversionError;
fn try_from(value: Response) -> ::std::result::Result<Self, super::error::ConversionError> {
Ok(Self {
disclosed_to: value.disclosed_to?,
existed: value.existed?,
ext: value.ext?,
profile_id: value.profile_id?,
unbound_personas: value.unbound_personas?,
})
}
}
impl ::std::convert::From<super::Response> for Response {
fn from(value: super::Response) -> Self {
Self {
disclosed_to: Ok(value.disclosed_to),
existed: Ok(value.existed),
ext: Ok(value.ext),
profile_id: Ok(value.profile_id),
unbound_personas: Ok(value.unbound_personas),
}
}
}
#[derive(Clone, Debug)]
pub struct ResponseDisclosedTo {
context_count: ::std::result::Result<u64, ::std::string::String>,
party_count: ::std::result::Result<u64, ::std::string::String>,
}
impl ::std::default::Default for ResponseDisclosedTo {
fn default() -> Self {
Self {
context_count: Err("no value supplied for context_count".to_string()),
party_count: Err("no value supplied for party_count".to_string()),
}
}
}
impl ResponseDisclosedTo {
pub fn context_count<T>(mut self, value: T) -> Self
where
T: ::std::convert::TryInto<u64>,
T::Error: ::std::fmt::Display,
{
self.context_count = value
.try_into()
.map_err(|e| format!("error converting supplied value for context_count: {e}"));
self
}
pub fn party_count<T>(mut self, value: T) -> Self
where
T: ::std::convert::TryInto<u64>,
T::Error: ::std::fmt::Display,
{
self.party_count = value
.try_into()
.map_err(|e| format!("error converting supplied value for party_count: {e}"));
self
}
}
impl ::std::convert::TryFrom<ResponseDisclosedTo> for super::ResponseDisclosedTo {
type Error = super::error::ConversionError;
fn try_from(
value: ResponseDisclosedTo,
) -> ::std::result::Result<Self, super::error::ConversionError> {
Ok(Self {
context_count: value.context_count?,
party_count: value.party_count?,
})
}
}
impl ::std::convert::From<super::ResponseDisclosedTo> for ResponseDisclosedTo {
fn from(value: super::ResponseDisclosedTo) -> Self {
Self {
context_count: Ok(value.context_count),
party_count: Ok(value.party_count),
}
}
}
}
impl crate::Payload for Payload {
const TYPE_URI: &'static str = "https://trusttasks.org/spec/persona/profile/delete/1.0";
const IS_PROOF_REQUIRED: bool = true;
const IS_ISSUED_AT_REQUIRED: bool = true;
const IS_RECIPIENT_REQUIRED: bool = true;
const PAYLOAD_SCHEMA: Option<&'static str> = Some(
"{\"$defs\":{\"ExpectedVersion\":{\"description\":\"Optimistic-concurrency precondition. A positive value requires the record's current `version` to equal it exactly; zero means create-only and applies only when no live record exists at the address.\",\"minimum\":0,\"title\":\"ExpectedVersion\",\"type\":\"integer\"},\"Ext\":{\"additionalProperties\":true,\"description\":\"Vendor-namespaced extension object per SPEC.md §4.5.1. Each immediate key MUST be a reverse-DNS namespace; structure under each namespace is opaque to the framework.\",\"minProperties\":1,\"propertyNames\":{\"pattern\":\"^[a-z][a-z0-9-]*(\\\\.[a-z0-9-]+)+$\"},\"title\":\"Ext\",\"type\":\"object\"},\"Response\":{\"$anchor\":\"response\",\"additionalProperties\":false,\"description\":\"Success response to persona/profile/delete. Type https://trusttasks.org/spec/persona/profile/delete/1.0#response. Deleting an absent profile is a success carrying existed: false, which is what makes a repeated delete converge.\",\"properties\":{\"disclosedTo\":{\"additionalProperties\":false,\"description\":\"How many distinct parties this face has disclosed to, across how many contexts, from the holder's disclosure history. Counts, not identifiers; persona/disclosure/history names them. Returned on the delete because the delete does not un-tell anyone: the history, and what those parties hold, remain.\",\"properties\":{\"contextCount\":{\"minimum\":0,\"type\":\"integer\"},\"partyCount\":{\"minimum\":0,\"type\":\"integer\"}},\"required\":[\"partyCount\",\"contextCount\"],\"type\":\"object\"},\"existed\":{\"description\":\"False when no live profile was present. A repeat delete returns false and deliberately takes no new version, so watchers never observe a change that did not happen.\",\"type\":\"boolean\"},\"ext\":{\"$ref\":\"#/$defs/Ext\"},\"profileId\":{\"$ref\":\"#/$defs/Ulid\"},\"unboundPersonas\":{\"description\":\"Persona DIDs whose bindings were cleared. Present only when `unbind` was true and something was cleared — a holder is owed the list of which personas their one action left presenting nothing.\",\"items\":{\"minLength\":1,\"type\":\"string\"},\"maxItems\":256,\"type\":\"array\"}},\"required\":[\"profileId\",\"existed\"],\"title\":\"Persona Profile Delete — response payload\",\"type\":\"object\"},\"Ulid\":{\"description\":\"A ULID in Crockford base32, uppercase. Used for `attributeId` and `profileId`. Chosen over a UUID because the leading 48 bits are a timestamp, so a key-ordered scan of the store is also creation-ordered and a `list` needs no secondary sort. Server-assigned on create; a producer MAY supply one to make a create idempotent, and a maintainer MUST reject a supplied value that already exists rather than silently overwriting.\",\"pattern\":\"^[0-9A-HJKMNP-TV-Z]{26}$\",\"title\":\"Ulid\",\"type\":\"string\"}},\"$id\":\"https://trusttasks.org/spec/persona/profile/delete/1.0\",\"$schema\":\"https://json-schema.org/draft/2020-12/schema\",\"additionalProperties\":false,\"description\":\"Remove one profile. Refused by default while a persona is still bound to it, because a bound persona whose profile vanished would present nothing without the holder having said so.\",\"properties\":{\"expectedVersion\":{\"$ref\":\"#/$defs/ExpectedVersion\"},\"ext\":{\"$ref\":\"#/$defs/Ext\"},\"profileId\":{\"$ref\":\"#/$defs/Ulid\"},\"unbind\":{\"default\":false,\"description\":\"When false (the default) a bound profile is refused and the error names the bound personas. When true the profile is removed and every binding to it is cleared, leaving those personas with no profile — which is a legal state, and one the holder is told about rather than discovering. Never the default: a persona that silently stopped presenting anything is a failure a holder finds out about from the other side.\",\"type\":\"boolean\"}},\"required\":[\"profileId\"],\"title\":\"Persona Profile Delete — payload\",\"type\":\"object\"}\n",
);
}
impl crate::Payload for Response {
const TYPE_URI: &'static str =
"https://trusttasks.org/spec/persona/profile/delete/1.0#response";
const IS_PROOF_REQUIRED: bool = true;
const IS_ISSUED_AT_REQUIRED: bool = true;
const IS_RECIPIENT_REQUIRED: bool = true;
const PAYLOAD_SCHEMA: Option<&'static str> = Some(
"{\"$defs\":{\"ExpectedVersion\":{\"description\":\"Optimistic-concurrency precondition. A positive value requires the record's current `version` to equal it exactly; zero means create-only and applies only when no live record exists at the address.\",\"minimum\":0,\"title\":\"ExpectedVersion\",\"type\":\"integer\"},\"Ext\":{\"additionalProperties\":true,\"description\":\"Vendor-namespaced extension object per SPEC.md §4.5.1. Each immediate key MUST be a reverse-DNS namespace; structure under each namespace is opaque to the framework.\",\"minProperties\":1,\"propertyNames\":{\"pattern\":\"^[a-z][a-z0-9-]*(\\\\.[a-z0-9-]+)+$\"},\"title\":\"Ext\",\"type\":\"object\"},\"Response\":{\"$anchor\":\"response\",\"additionalProperties\":false,\"description\":\"Success response to persona/profile/delete. Type https://trusttasks.org/spec/persona/profile/delete/1.0#response. Deleting an absent profile is a success carrying existed: false, which is what makes a repeated delete converge.\",\"properties\":{\"disclosedTo\":{\"additionalProperties\":false,\"description\":\"How many distinct parties this face has disclosed to, across how many contexts, from the holder's disclosure history. Counts, not identifiers; persona/disclosure/history names them. Returned on the delete because the delete does not un-tell anyone: the history, and what those parties hold, remain.\",\"properties\":{\"contextCount\":{\"minimum\":0,\"type\":\"integer\"},\"partyCount\":{\"minimum\":0,\"type\":\"integer\"}},\"required\":[\"partyCount\",\"contextCount\"],\"type\":\"object\"},\"existed\":{\"description\":\"False when no live profile was present. A repeat delete returns false and deliberately takes no new version, so watchers never observe a change that did not happen.\",\"type\":\"boolean\"},\"ext\":{\"$ref\":\"#/$defs/Ext\"},\"profileId\":{\"$ref\":\"#/$defs/Ulid\"},\"unboundPersonas\":{\"description\":\"Persona DIDs whose bindings were cleared. Present only when `unbind` was true and something was cleared — a holder is owed the list of which personas their one action left presenting nothing.\",\"items\":{\"minLength\":1,\"type\":\"string\"},\"maxItems\":256,\"type\":\"array\"}},\"required\":[\"profileId\",\"existed\"],\"title\":\"Persona Profile Delete — response payload\",\"type\":\"object\"},\"Ulid\":{\"description\":\"A ULID in Crockford base32, uppercase. Used for `attributeId` and `profileId`. Chosen over a UUID because the leading 48 bits are a timestamp, so a key-ordered scan of the store is also creation-ordered and a `list` needs no secondary sort. Server-assigned on create; a producer MAY supply one to make a create idempotent, and a maintainer MUST reject a supplied value that already exists rather than silently overwriting.\",\"pattern\":\"^[0-9A-HJKMNP-TV-Z]{26}$\",\"title\":\"Ulid\",\"type\":\"string\"}},\"$ref\":\"#/$defs/Response\",\"$schema\":\"https://json-schema.org/draft/2020-12/schema\"}\n",
);
}
impl crate::RequestPayload for Payload {
type Response = Response;
}
/// The earlier `MAJOR.MINOR` of this slug that this version declares it
/// extends (front matter `extends`, SPEC §5.2 "Declared extension"), or
/// `None`. Only the direct declaration; walk a chain with
/// [`crate::extension::extends_for`].
pub const EXTENDS: Option<&str> = None;
/// The extended error codes this specification declares (SPEC §7.3 item 9,
/// §8.5), in declaration order. Empty when it declares none.
pub const ERROR_CODES: &[crate::DeclaredErrorCode] =
&[error_codes::BOUND, error_codes::VERSION_CONFLICT];
/// One constant per extended error code this specification declares
/// (SPEC §7.3 item 9), named for its local part.
///
/// Emit these rather than a string literal: the code is read from the
/// specification, so it cannot name a code the specification never
/// declared.
pub mod error_codes {
/// `persona/profile/delete:bound`
///
/// A persona is still bound to this profile and `unbind` was not set. The details name the bound persona DIDs so the holder can decide between rebinding them and unbinding.
///
/// Declared `retryable: false`.
/// Declares a `detailsSchema` for the error's `details` member.
pub const BOUND: crate::DeclaredErrorCode = crate::DeclaredErrorCode {
code: "persona/profile/delete:bound",
retryable: false,
details_schema: ::core::option::Option::Some(
"{\"additionalProperties\":false,\"properties\":{\"personaDids\":{\"items\":{\"type\":\"string\"},\"maxItems\":256,\"type\":\"array\"}},\"required\":[\"personaDids\"],\"type\":\"object\"}",
),
};
/// `persona/profile/delete:versionConflict`
///
/// The expectedVersion precondition failed.
///
/// Declared `retryable: false`.
pub const VERSION_CONFLICT: crate::DeclaredErrorCode = crate::DeclaredErrorCode {
code: "persona/profile/delete:versionConflict",
retryable: false,
details_schema: ::core::option::Option::None,
};
}