use derive_empty_traits::EmptyTraits;
use resolver_api::Resolve;
use serde::{Deserialize, Serialize};
use typeshare::typeshare;
use crate::entities::user::User;
use super::KomodoWriteRequest;
#[typeshare]
#[derive(
Serialize, Deserialize, Debug, Clone, Resolve, EmptyTraits,
)]
#[cfg_attr(feature = "openapi", derive(utoipa::ToSchema))]
#[empty_traits(KomodoWriteRequest)]
#[response(DeleteUserResponse)]
#[error(serror::Error)]
pub struct DeleteUser {
#[serde(alias = "username", alias = "id")]
pub user: String,
}
#[typeshare]
pub type DeleteUserResponse = User;
#[typeshare]
#[derive(
Serialize, Deserialize, Debug, Clone, Resolve, EmptyTraits,
)]
#[cfg_attr(feature = "openapi", derive(utoipa::ToSchema))]
#[empty_traits(KomodoWriteRequest)]
#[response(CreateLocalUserResponse)]
#[error(serror::Error)]
pub struct CreateLocalUser {
pub username: String,
pub password: String,
}
#[typeshare]
pub type CreateLocalUserResponse = User;
#[typeshare]
#[derive(
Serialize, Deserialize, Debug, Clone, Resolve, EmptyTraits,
)]
#[cfg_attr(feature = "openapi", derive(utoipa::ToSchema))]
#[empty_traits(KomodoWriteRequest)]
#[response(CreateServiceUserResponse)]
#[error(serror::Error)]
pub struct CreateServiceUser {
pub username: String,
pub description: String,
}
#[typeshare]
pub type CreateServiceUserResponse = User;
#[typeshare]
#[derive(
Serialize, Deserialize, Debug, Clone, Resolve, EmptyTraits,
)]
#[cfg_attr(feature = "openapi", derive(utoipa::ToSchema))]
#[empty_traits(KomodoWriteRequest)]
#[response(UpdateServiceUserDescriptionResponse)]
#[error(serror::Error)]
pub struct UpdateServiceUserDescription {
pub username: String,
pub description: String,
}
#[typeshare]
pub type UpdateServiceUserDescriptionResponse = User;