use serde::{Deserialize, Serialize};
use utoipa::ToSchema;
use uuid::Uuid;
#[derive(Debug, Clone, Serialize, Deserialize, ToSchema)]
pub struct RegistryPackageResponse {
pub package: String,
pub version: String,
pub artifact: serde_json::Value,
pub tarball: String, pub checksum: String,
pub download_url: String,
pub metadata: RegistryPackageMetadata,
}
#[derive(Debug, Clone, Serialize, Deserialize, ToSchema)]
pub struct RegistryPackageMetadata {
pub created_at: chrono::DateTime<chrono::Utc>,
pub is_yanked: bool,
}
#[derive(Debug, Clone, Serialize, Deserialize, ToSchema)]
pub struct RegistryPackageVersion {
pub id: Uuid,
pub package_id: Uuid,
pub version: String,
pub artifact: serde_json::Value,
pub tarball: String, pub checksum: String,
pub is_yanked: bool,
pub created_at: chrono::DateTime<chrono::Utc>,
pub updated_at: chrono::DateTime<chrono::Utc>,
}
#[derive(Debug, Clone, Serialize, Deserialize, ToSchema)]
pub struct RegistryPackage {
pub id: Uuid,
pub name: String,
pub description: Option<String>,
pub owner_id: Uuid,
pub created_at: chrono::DateTime<chrono::Utc>,
pub updated_at: chrono::DateTime<chrono::Utc>,
}
#[derive(Debug, Clone, Serialize, Deserialize, ToSchema)]
pub struct RegistryPackageDetail {
pub id: Uuid,
pub name: String,
pub description: Option<String>,
pub owner_id: Uuid,
pub created_at: chrono::DateTime<chrono::Utc>,
pub updated_at: chrono::DateTime<chrono::Utc>,
pub versions: Vec<RegistryPackageVersion>,
pub latest_version: Option<String>,
}
#[derive(Debug, Clone, Serialize, Deserialize, ToSchema)]
pub struct RegistrySearchQuery {
pub q: Option<String>,
pub page: Option<i64>,
pub limit: Option<i64>,
pub sort: Option<String>,
}
#[derive(Debug, Clone, Serialize, Deserialize, ToSchema)]
pub struct RegistrySearchResults {
pub packages: Vec<RegistryPackage>,
pub total: i64,
pub page: i64,
pub limit: i64,
pub total_pages: i64,
}
#[derive(Debug, Clone, Serialize, Deserialize, ToSchema)]
pub struct RegistryPublishRequest {
pub name: String,
pub version: String,
pub artifact: serde_json::Value,
pub tarball: String, }
#[derive(Debug, Clone, Serialize, Deserialize, ToSchema)]
pub struct RegistryPublishResponse {
pub message: String,
pub package_id: Uuid,
pub version_id: Uuid,
}
#[derive(Debug, Clone, Serialize, Deserialize, ToSchema)]
pub struct RegistryYankRequest {
pub yanked: bool,
}
#[derive(Debug, Clone, Serialize, Deserialize, ToSchema)]
pub struct RegistryYankResponse {
pub message: String,
pub version: String,
pub yanked: bool,
}
#[derive(Debug, Clone, Serialize, Deserialize, ToSchema)]
pub struct RegistryApiError {
pub error: String,
pub message: String,
}
#[derive(Debug, Clone, Serialize, Deserialize, ToSchema)]
pub struct RegistryUserInfo {
pub id: Uuid,
pub email: String,
pub name: Option<String>,
pub email_verified: bool,
}
#[derive(Debug, Clone, Serialize, Deserialize, ToSchema)]
pub struct RegistryLoginRequest {
pub email: String,
pub password: String,
}
#[derive(Debug, Clone, Serialize, Deserialize, ToSchema)]
pub struct RegistryLoginResponse {
pub message: String,
pub token: String,
pub user: RegistryUserInfo,
}
#[derive(Debug, Clone, Serialize, Deserialize, ToSchema)]
pub struct RegistryRegisterRequest {
pub email: String,
pub password: String,
pub name: Option<String>,
}