use serde::{Deserialize, Serialize};
pub use crate::profile::{
ProfileProperty, TextureEntry, TextureMetadata, TextureType, TexturesPayload,
};
use crate::error::{Error, Result};
use crate::profile::decode_textures_property;
use crate::uuid::McUuid;
#[derive(Clone, Debug, Deserialize, Serialize, Eq, PartialEq)]
pub struct NameUuidEntry {
pub id: McUuid,
pub name: String,
}
#[derive(Clone, Debug, Deserialize, Serialize, Eq, PartialEq)]
#[serde(rename_all = "camelCase")]
pub struct SessionProfile {
pub id: McUuid,
pub name: String,
#[serde(default)]
pub properties: Vec<ProfileProperty>,
#[serde(default)]
pub profile_actions: Vec<String>,
}
impl SessionProfile {
pub fn decode_textures(&self) -> Result<TexturesPayload> {
decode_textures_property(&self.properties)?.ok_or(Error::MissingTexturesProperty)
}
}
#[derive(Clone, Debug, Deserialize, Serialize)]
#[serde(rename_all = "camelCase")]
pub struct PublicKeysResponse {
#[serde(default)]
pub player_certificate_keys: Vec<PublicKeyItem>,
#[serde(default)]
pub profile_property_keys: Vec<PublicKeyItem>,
}
#[derive(Clone, Debug, Deserialize, Serialize)]
#[serde(rename_all = "camelCase")]
pub struct PublicKeyItem {
pub public_key: String,
}