configs/
portal_rarities.rs

1use essences::items::ItemRarityId;
2use schema_loader::{asset_portal_rarity_icon_schema, id_schema, item_rarity_link_id_schema};
3use schemars::JsonSchema;
4use serde::{Deserialize, Serialize};
5use tsify_next::{Tsify, declare};
6use uuid::Uuid;
7
8/// Stable identifier of a portal-rarity presentation record.
9#[declare]
10pub type PortalRarityId = Uuid;
11
12/// Portal-specific presentation mapped to an existing item-rarity tier.
13///
14/// Name, color, and ordering remain owned by the linked item rarity so the two
15/// catalogs cannot drift.
16#[derive(Clone, Debug, Deserialize, Eq, JsonSchema, PartialEq, Serialize, Tsify)]
17pub struct PortalRarity {
18    /// Globally unique identifier of this portal-rarity record.
19    #[schemars(schema_with = "id_schema")]
20    pub id: PortalRarityId,
21
22    /// Item rarity that supplies this portal tier's name, color, and order.
23    #[schemars(
24        title = "Редкость предмета",
25        schema_with = "item_rarity_link_id_schema"
26    )]
27    pub item_rarity_id: ItemRarityId,
28
29    /// Unity address of the portal sprite for this rarity tier.
30    #[schemars(
31        title = "Иконка портала",
32        schema_with = "asset_portal_rarity_icon_schema"
33    )]
34    pub icon_path: String,
35}