fts_core/models/
product.rs

1use crate::models::ProductId;
2use serde::{Deserialize, Serialize};
3
4/// A product record combines a standard product ID with implementation-specific data.
5///
6/// Products are the fundamental tradable entities in the system. The core only defines
7/// products by their ID, allowing implementations to attach domain-specific data.
8///
9/// Product records are immutable once defined.
10#[derive(Serialize, Deserialize)]
11pub struct ProductRecord<T> {
12    /// Unique identifier for the product
13    pub id: ProductId,
14    /// Additional product-specific data defined by the implementation
15    #[serde(flatten)]
16    pub data: T,
17}
18
19/// Standard response format for product queries.
20///
21/// This structure provides a consistent format for returning product query results,
22/// including optional pagination metadata.
23#[derive(Serialize)]
24pub struct ProductQueryResponse<T, U> {
25    /// Collection of product query results
26    pub results: Vec<T>,
27    /// Optional pagination information for retrieving additional results
28    #[serde(skip_serializing_if = "Option::is_none")]
29    pub more: Option<U>,
30}