#[allow(unused_imports)]
use alloc::collections::BTreeMap;
#[allow(unused_imports)]
use core::marker::PhantomData;
use jacquard_common::{BosStr, DefaultStr, FromStaticStr};
use jacquard_common::deps::smol_str::SmolStr;
use jacquard_common::types::value::Data;
use jacquard_derive::{IntoStatic, open_union};
use serde::{Serialize, Deserialize};
use crate::com_atproto::admin::RepoBlobRef;
use crate::com_atproto::admin::RepoRef;
use crate::com_atproto::admin::StatusAttr;
use crate::com_atproto::repo::strong_ref::StrongRef;
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
#[serde(rename_all = "camelCase", bound(deserialize = "S: Deserialize<'de> + BosStr"))]
pub struct UpdateSubjectStatus<S: BosStr = DefaultStr> {
#[serde(skip_serializing_if = "Option::is_none")]
pub deactivated: Option<StatusAttr<S>>,
pub subject: UpdateSubjectStatusSubject<S>,
#[serde(skip_serializing_if = "Option::is_none")]
pub takedown: Option<StatusAttr<S>>,
#[serde(flatten, default, skip_serializing_if = "Option::is_none")]
pub extra_data: Option<BTreeMap<SmolStr, Data<S>>>,
}
#[open_union]
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
#[serde(tag = "$type", bound(deserialize = "S: Deserialize<'de> + BosStr"))]
pub enum UpdateSubjectStatusSubject<S: BosStr = DefaultStr> {
#[serde(rename = "com.atproto.admin.defs#repoRef")]
RepoRef(Box<RepoRef<S>>),
#[serde(rename = "com.atproto.repo.strongRef")]
StrongRef(Box<StrongRef<S>>),
#[serde(rename = "com.atproto.admin.defs#repoBlobRef")]
RepoBlobRef(Box<RepoBlobRef<S>>),
}
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
#[serde(rename_all = "camelCase", bound(deserialize = "S: Deserialize<'de> + BosStr"))]
pub struct UpdateSubjectStatusOutput<S: BosStr = DefaultStr> {
pub subject: UpdateSubjectStatusOutputSubject<S>,
#[serde(skip_serializing_if = "Option::is_none")]
pub takedown: Option<StatusAttr<S>>,
#[serde(flatten, default, skip_serializing_if = "Option::is_none")]
pub extra_data: Option<BTreeMap<SmolStr, Data<S>>>,
}
#[open_union]
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
#[serde(tag = "$type", bound(deserialize = "S: Deserialize<'de> + BosStr"))]
pub enum UpdateSubjectStatusOutputSubject<S: BosStr = DefaultStr> {
#[serde(rename = "com.atproto.admin.defs#repoRef")]
RepoRef(Box<RepoRef<S>>),
#[serde(rename = "com.atproto.repo.strongRef")]
StrongRef(Box<StrongRef<S>>),
#[serde(rename = "com.atproto.admin.defs#repoBlobRef")]
RepoBlobRef(Box<RepoBlobRef<S>>),
}
pub struct UpdateSubjectStatusResponse;
impl jacquard_common::xrpc::XrpcResp for UpdateSubjectStatusResponse {
const NSID: &'static str = "com.atproto.admin.updateSubjectStatus";
const ENCODING: &'static str = "application/json";
type Output<S: BosStr> = UpdateSubjectStatusOutput<S>;
type Err = jacquard_common::xrpc::GenericError;
}
impl<S: BosStr> jacquard_common::xrpc::XrpcRequest for UpdateSubjectStatus<S> {
const NSID: &'static str = "com.atproto.admin.updateSubjectStatus";
const METHOD: jacquard_common::xrpc::XrpcMethod = jacquard_common::xrpc::XrpcMethod::Procedure(
"application/json",
);
type Response = UpdateSubjectStatusResponse;
}
pub struct UpdateSubjectStatusRequest;
impl jacquard_common::xrpc::XrpcEndpoint for UpdateSubjectStatusRequest {
const PATH: &'static str = "/xrpc/com.atproto.admin.updateSubjectStatus";
const METHOD: jacquard_common::xrpc::XrpcMethod = jacquard_common::xrpc::XrpcMethod::Procedure(
"application/json",
);
type Request<S: BosStr> = UpdateSubjectStatus<S>;
type Response = UpdateSubjectStatusResponse;
}
pub mod update_subject_status_state {
pub use crate::builder_types::{Set, Unset, IsSet, IsUnset};
#[allow(unused)]
use ::core::marker::PhantomData;
mod sealed {
pub trait Sealed {}
}
pub trait State: sealed::Sealed {
type Subject;
}
pub struct Empty(());
impl sealed::Sealed for Empty {}
impl State for Empty {
type Subject = Unset;
}
pub struct SetSubject<St: State = Empty>(PhantomData<fn() -> St>);
impl<St: State> sealed::Sealed for SetSubject<St> {}
impl<St: State> State for SetSubject<St> {
type Subject = Set<members::subject>;
}
#[allow(non_camel_case_types)]
pub mod members {
pub struct subject(());
}
}
pub struct UpdateSubjectStatusBuilder<
S: BosStr,
St: update_subject_status_state::State,
> {
_state: PhantomData<fn() -> St>,
_fields: (
Option<StatusAttr<S>>,
Option<UpdateSubjectStatusSubject<S>>,
Option<StatusAttr<S>>,
),
_type: PhantomData<fn() -> S>,
}
impl<S: BosStr> UpdateSubjectStatus<S> {
pub fn new() -> UpdateSubjectStatusBuilder<S, update_subject_status_state::Empty> {
UpdateSubjectStatusBuilder::new()
}
}
impl<S: BosStr> UpdateSubjectStatusBuilder<S, update_subject_status_state::Empty> {
pub fn new() -> Self {
UpdateSubjectStatusBuilder {
_state: PhantomData,
_fields: (None, None, None),
_type: PhantomData,
}
}
}
impl<
S: BosStr,
St: update_subject_status_state::State,
> UpdateSubjectStatusBuilder<S, St> {
pub fn deactivated(mut self, value: impl Into<Option<StatusAttr<S>>>) -> Self {
self._fields.0 = value.into();
self
}
pub fn maybe_deactivated(mut self, value: Option<StatusAttr<S>>) -> Self {
self._fields.0 = value;
self
}
}
impl<S: BosStr, St> UpdateSubjectStatusBuilder<S, St>
where
St: update_subject_status_state::State,
St::Subject: update_subject_status_state::IsUnset,
{
pub fn subject(
mut self,
value: impl Into<UpdateSubjectStatusSubject<S>>,
) -> UpdateSubjectStatusBuilder<S, update_subject_status_state::SetSubject<St>> {
self._fields.1 = Option::Some(value.into());
UpdateSubjectStatusBuilder {
_state: PhantomData,
_fields: self._fields,
_type: PhantomData,
}
}
}
impl<
S: BosStr,
St: update_subject_status_state::State,
> UpdateSubjectStatusBuilder<S, St> {
pub fn takedown(mut self, value: impl Into<Option<StatusAttr<S>>>) -> Self {
self._fields.2 = value.into();
self
}
pub fn maybe_takedown(mut self, value: Option<StatusAttr<S>>) -> Self {
self._fields.2 = value;
self
}
}
impl<S: BosStr, St> UpdateSubjectStatusBuilder<S, St>
where
St: update_subject_status_state::State,
St::Subject: update_subject_status_state::IsSet,
{
pub fn build(self) -> UpdateSubjectStatus<S> {
UpdateSubjectStatus {
deactivated: self._fields.0,
subject: self._fields.1.unwrap(),
takedown: self._fields.2,
extra_data: Default::default(),
}
}
pub fn build_with_data(
self,
extra_data: BTreeMap<SmolStr, Data<S>>,
) -> UpdateSubjectStatus<S> {
UpdateSubjectStatus {
deactivated: self._fields.0,
subject: self._fields.1.unwrap(),
takedown: self._fields.2,
extra_data: Some(extra_data),
}
}
}