// @generated by jacquard-lexicon. DO NOT EDIT.
//
// Lexicon: com.atproto.admin.getSubjectStatus
//
// This file was automatically generated from Lexicon schemas.
// Any manual changes will be overwritten on the next regeneration.

#[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::string::{Did, AtUri, Cid};
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 GetSubjectStatus<S: BosStr = DefaultStr> {
    #[serde(skip_serializing_if = "Option::is_none")]
    pub blob: Option<Cid<S>>,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub did: Option<Did<S>>,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub uri: Option<AtUri<S>>,
}


#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
#[serde(rename_all = "camelCase", bound(deserialize = "S: Deserialize<'de> + BosStr"))]
pub struct GetSubjectStatusOutput<S: BosStr = DefaultStr> {
    #[serde(skip_serializing_if = "Option::is_none")]
    pub deactivated: Option<StatusAttr<S>>,
    pub subject: GetSubjectStatusOutputSubject<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 GetSubjectStatusOutputSubject<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>>),
}

/** Response marker for the `com.atproto.admin.getSubjectStatus` query.

Implements `jacquard_common::xrpc::XrpcResp`; successful bodies decode as `Self::Output<S>`, which is `GetSubjectStatusOutput<S>` for this endpoint.*/
pub struct GetSubjectStatusResponse;
impl jacquard_common::xrpc::XrpcResp for GetSubjectStatusResponse {
    const NSID: &'static str = "com.atproto.admin.getSubjectStatus";
    const ENCODING: &'static str = "application/json";
    type Output<S: BosStr> = GetSubjectStatusOutput<S>;
    type Err = jacquard_common::xrpc::GenericError;
}

impl<S: BosStr> jacquard_common::xrpc::XrpcRequest for GetSubjectStatus<S> {
    const NSID: &'static str = "com.atproto.admin.getSubjectStatus";
    const METHOD: jacquard_common::xrpc::XrpcMethod = jacquard_common::xrpc::XrpcMethod::Query;
    type Response = GetSubjectStatusResponse;
}

/** Endpoint marker for the `com.atproto.admin.getSubjectStatus` query.

Path: `/xrpc/com.atproto.admin.getSubjectStatus`. The request payload type is `GetSubjectStatus<S>`; send that request with `jacquard::Client` or use this marker through lower-level `XrpcEndpoint` APIs.*/
pub struct GetSubjectStatusRequest;
impl jacquard_common::xrpc::XrpcEndpoint for GetSubjectStatusRequest {
    const PATH: &'static str = "/xrpc/com.atproto.admin.getSubjectStatus";
    const METHOD: jacquard_common::xrpc::XrpcMethod = jacquard_common::xrpc::XrpcMethod::Query;
    type Request<S: BosStr> = GetSubjectStatus<S>;
    type Response = GetSubjectStatusResponse;
}

pub mod get_subject_status_state {

    pub use crate::builder_types::{Set, Unset, IsSet, IsUnset};
    #[allow(unused)]
    use ::core::marker::PhantomData;
    mod sealed {
        pub trait Sealed {}
    }
    /// State trait tracking which required fields have been set
    pub trait State: sealed::Sealed {}
    /// Empty state - all required fields are unset
    pub struct Empty(());
    impl sealed::Sealed for Empty {}
    impl State for Empty {}
    /// Marker types for field names
    #[allow(non_camel_case_types)]
    pub mod members {}
}

/// Builder for constructing an instance of this type.
pub struct GetSubjectStatusBuilder<
    St: get_subject_status_state::State,
    S: BosStr = DefaultStr,
> {
    _state: PhantomData<fn() -> St>,
    _fields: (Option<Cid<S>>, Option<Did<S>>, Option<AtUri<S>>),
    _type: PhantomData<fn() -> S>,
}

impl GetSubjectStatus<DefaultStr> {
    /// Create a new builder for this type, using the default string type (DefaultStr = SmolStr) if needed
    pub fn new() -> GetSubjectStatusBuilder<
        get_subject_status_state::Empty,
        DefaultStr,
    > {
        GetSubjectStatusBuilder::new()
    }
}

impl<S: BosStr> GetSubjectStatus<S> {
    /// Create a new builder for this type
    pub fn builder() -> GetSubjectStatusBuilder<get_subject_status_state::Empty, S> {
        GetSubjectStatusBuilder::builder()
    }
}

impl GetSubjectStatusBuilder<get_subject_status_state::Empty, DefaultStr> {
    /// Create a new builder with all fields unset, using the default string type, if needed
    pub fn new() -> Self {
        GetSubjectStatusBuilder {
            _state: PhantomData,
            _fields: (None, None, None),
            _type: PhantomData,
        }
    }
}

impl<S: BosStr> GetSubjectStatusBuilder<get_subject_status_state::Empty, S> {
    /// Create a new builder with all fields unset
    pub fn builder() -> Self {
        GetSubjectStatusBuilder {
            _state: PhantomData,
            _fields: (None, None, None),
            _type: PhantomData,
        }
    }
}

impl<St: get_subject_status_state::State, S: BosStr> GetSubjectStatusBuilder<St, S> {
    /// Set the `blob` field (optional)
    pub fn blob(mut self, value: impl Into<Option<Cid<S>>>) -> Self {
        self._fields.0 = value.into();
        self
    }
    /// Set the `blob` field to an Option value (optional)
    pub fn maybe_blob(mut self, value: Option<Cid<S>>) -> Self {
        self._fields.0 = value;
        self
    }
}

impl<St: get_subject_status_state::State, S: BosStr> GetSubjectStatusBuilder<St, S> {
    /// Set the `did` field (optional)
    pub fn did(mut self, value: impl Into<Option<Did<S>>>) -> Self {
        self._fields.1 = value.into();
        self
    }
    /// Set the `did` field to an Option value (optional)
    pub fn maybe_did(mut self, value: Option<Did<S>>) -> Self {
        self._fields.1 = value;
        self
    }
}

impl<St: get_subject_status_state::State, S: BosStr> GetSubjectStatusBuilder<St, S> {
    /// Set the `uri` field (optional)
    pub fn uri(mut self, value: impl Into<Option<AtUri<S>>>) -> Self {
        self._fields.2 = value.into();
        self
    }
    /// Set the `uri` field to an Option value (optional)
    pub fn maybe_uri(mut self, value: Option<AtUri<S>>) -> Self {
        self._fields.2 = value;
        self
    }
}

impl<St, S: BosStr> GetSubjectStatusBuilder<St, S>
where
    St: get_subject_status_state::State,
{
    /// Build the final struct.
    pub fn build(self) -> GetSubjectStatus<S> {
        GetSubjectStatus {
            blob: self._fields.0,
            did: self._fields.1,
            uri: self._fields.2,
        }
    }
}