Files
projectmycelium/src/models/marketplace.rs
2025-09-01 21:37:01 -04:00

82 lines
2.7 KiB
Rust

use serde::{Deserialize, Serialize};
/// Configuration for the marketplace
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct MarketplaceConfig {
pub marketplace: MarketplaceInfo,
pub product_types: Vec<ProductTypeConfig>,
}
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct MarketplaceInfo {
pub name: String,
pub marketplace_type: String,
pub base_currency: String,
pub default_display_currency: String,
pub supported_languages: Vec<String>,
pub features: MarketplaceFeatures,
}
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct MarketplaceFeatures {
pub reviews_enabled: bool,
pub wishlist_enabled: bool,
pub recommendations_enabled: bool,
pub multi_vendor: bool,
pub subscription_products: bool,
}
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct ProductTypeConfig {
pub id: String,
pub name: String,
pub icon: String,
pub pricing_model: String,
}
impl Default for MarketplaceConfig {
fn default() -> Self {
Self {
marketplace: MarketplaceInfo {
name: "Project Mycelium".to_string(),
marketplace_type: "infrastructure".to_string(),
base_currency: "USD".to_string(),
default_display_currency: "USD".to_string(),
supported_languages: vec!["en".to_string()],
features: MarketplaceFeatures {
reviews_enabled: false,
wishlist_enabled: false,
recommendations_enabled: false,
multi_vendor: false,
subscription_products: false,
},
},
product_types: vec![
ProductTypeConfig {
id: "compute".to_string(),
name: "Compute Resources".to_string(),
icon: "cpu".to_string(),
pricing_model: "usage_based".to_string(),
},
ProductTypeConfig {
id: "hardware".to_string(),
name: "Hardware".to_string(),
icon: "server".to_string(),
pricing_model: "one_time".to_string(),
},
ProductTypeConfig {
id: "application".to_string(),
name: "Applications".to_string(),
icon: "apps".to_string(),
pricing_model: "recurring".to_string(),
},
ProductTypeConfig {
id: "service".to_string(),
name: "Services".to_string(),
icon: "tools".to_string(),
pricing_model: "one_time".to_string(),
},
],
}
}
}