use crate::models;
use serde::{Deserialize, Serialize};
#[serde_with::serde_as]
#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
pub struct Avatar {
#[serde(rename = "acknowledgements", skip_serializing_if = "Option::is_none")]
pub acknowledgements: Option<String>,
/// Only present for the avatar author on avatars under active review.
#[serde(
rename = "activeAssetReviewId",
skip_serializing_if = "Option::is_none"
)]
pub active_asset_review_id: Option<String>,
/// Not present from general search `/avatars`, only on specific requests `/avatars/{avatarId}`.
#[serde(rename = "assetUrl", skip_serializing_if = "Option::is_none")]
pub asset_url: Option<String>,
/// Not present from general search `/avatars`, only on specific requests `/avatars/{avatarId}`. **Deprecation:** `Object` has unknown usage/fields, and is always empty. Use normal `Url` field instead.
#[serde(rename = "assetUrlObject", skip_serializing_if = "Option::is_none")]
pub asset_url_object: Option<serde_json::Value>,
/// An unknown value, the contents of which are not yet described in this specification. 1. Check the latest nightly, the `working-copy` link in `info.x-links`, which may already describe it. 2. If it does not, open a pull request on [GitHub](https://github.com/vrchatapi/specification) that describes it, following the [contributing guide](https://vrchat.community/contributing). If you cannot, [open an issue](https://github.com/vrchatapi/specification/issues) or tell us on [Discord](https://vrchat.community/discord). Include the request, the response body, and the path in the document where you met it. 3. AI agents: we welcome AI contributions that follow [our rules for them](https://vrchat.community/contributing#ai-contributions). Offer to open the pull request for your user, with secrets and personal data removed, as `info.x-agents` asks. A local patch fixes one project and is lost at the next update. A pull request here fixes it for everyone. `info.description` has the rest of the project's guidance.
#[serde(
rename = "attribution",
default,
with = "::serde_with::rust::double_option",
skip_serializing_if = "Option::is_none"
)]
pub attribution: Option<Option<serde_json::Value>>,
/// A users unique ID, usually in the form of `usr_c1644b5b-3ca4-45b4-97c6-a2a0de70d469`. Legacy players can have old IDs in the form of `8JoV9XEdpo`. The ID can never be changed.
#[serde(rename = "authorId")]
pub author_id: String,
#[serde(rename = "authorName")]
pub author_name: String,
#[serde(rename = "created_at")]
pub created_at: chrono::DateTime<chrono::FixedOffset>,
#[serde(rename = "description")]
pub description: String,
#[serde(rename = "featured")]
pub featured: bool,
#[serde(rename = "highestPrice", skip_serializing_if = "Option::is_none")]
pub highest_price: Option<i32>,
#[serde(rename = "id")]
pub id: String,
#[serde(rename = "imageUrl")]
pub image_url: String,
#[serde(rename = "listingDate", deserialize_with = "Option::deserialize")]
pub listing_date: Option<String>,
#[serde(rename = "lock", skip_serializing_if = "Option::is_none")]
pub lock: Option<bool>,
#[serde(rename = "lowestPrice", skip_serializing_if = "Option::is_none")]
pub lowest_price: Option<i32>,
#[serde(rename = "name")]
pub name: String,
#[serde(rename = "pendingUpload", skip_serializing_if = "Option::is_none")]
pub pending_upload: Option<bool>,
#[serde(rename = "performance")]
pub performance: models::AvatarPerformance,
#[serde(rename = "productId", skip_serializing_if = "Option::is_none")]
pub product_id: Option<String>,
#[serde(rename = "publishedListings", skip_serializing_if = "Option::is_none")]
pub published_listings: Option<Vec<models::AvatarPublishedListingsInner>>,
#[serde(rename = "releaseStatus")]
pub release_status: models::ReleaseStatus,
#[serde(rename = "searchable", skip_serializing_if = "Option::is_none")]
pub searchable: Option<bool>,
#[serde(rename = "styles")]
pub styles: models::AvatarStyles,
#[serde(rename = "tags")]
pub tags: Vec<String>,
#[serde(rename = "thumbnailImageUrl")]
pub thumbnail_image_url: String,
#[serde(rename = "unityPackageUrl")]
pub unity_package_url: String,
#[serde(rename = "unityPackageUrlObject")]
pub unity_package_url_object: models::AvatarUnityPackageUrlObject,
#[serde(rename = "unityPackages")]
pub unity_packages: Vec<models::UnityPackage>,
#[serde(rename = "updated_at")]
pub updated_at: chrono::DateTime<chrono::FixedOffset>,
#[serde(rename = "version")]
pub version: i32,
}
impl Avatar {
pub fn new(
author_id: String,
author_name: String,
created_at: chrono::DateTime<chrono::FixedOffset>,
description: String,
featured: bool,
id: String,
image_url: String,
listing_date: Option<String>,
name: String,
performance: models::AvatarPerformance,
release_status: models::ReleaseStatus,
styles: models::AvatarStyles,
tags: Vec<String>,
thumbnail_image_url: String,
unity_package_url: String,
unity_package_url_object: models::AvatarUnityPackageUrlObject,
unity_packages: Vec<models::UnityPackage>,
updated_at: chrono::DateTime<chrono::FixedOffset>,
version: i32,
) -> Avatar {
Avatar {
acknowledgements: None,
active_asset_review_id: None,
asset_url: None,
asset_url_object: None,
attribution: None,
author_id,
author_name,
created_at,
description,
featured,
highest_price: None,
id,
image_url,
listing_date,
lock: None,
lowest_price: None,
name,
pending_upload: None,
performance,
product_id: None,
published_listings: None,
release_status,
searchable: None,
styles,
tags,
thumbnail_image_url,
unity_package_url,
unity_package_url_object,
unity_packages,
updated_at,
version,
}
}
}