|
1 | 1 | use crate::api_rest::model::{PaginatedRequest, PaginationResponse}; |
2 | 2 | use chrono::{DateTime, Utc}; |
3 | | -use common_domain::ids::{ |
4 | | - AddOnId, BillableMetricId, EntitlementId, FeatureId, PlanId, PlanVersionId, ProductId, QuoteId, |
5 | | - SubscriptionId, string_serde, |
6 | | -}; |
| 3 | +use common_domain::ids::{BillableMetricId, EntitlementId, FeatureId, ProductId, string_serde}; |
7 | 4 | use o2o::o2o; |
8 | 5 | use rust_decimal::Decimal; |
9 | 6 | use serde::{Deserialize, Serialize}; |
@@ -263,53 +260,6 @@ pub enum ResolvedEntitlementValue { |
263 | 260 | Metered(MeteredResolvedEntitlementValue), |
264 | 261 | } |
265 | 262 |
|
266 | | -#[derive(Serialize, Deserialize, Debug, Clone, ToSchema)] |
267 | | -pub struct FeatureEntitlementEntity { |
268 | | - #[serde(with = "common_domain::ids::string_serde")] |
269 | | - pub id: FeatureId, |
270 | | -} |
271 | | - |
272 | | -#[derive(Serialize, Deserialize, Debug, Clone, ToSchema)] |
273 | | -pub struct PlanEntitlementEntity { |
274 | | - #[serde(with = "common_domain::ids::string_serde")] |
275 | | - pub id: PlanId, |
276 | | -} |
277 | | - |
278 | | -#[derive(Serialize, Deserialize, Debug, Clone, ToSchema)] |
279 | | -pub struct PlanVersionEntitlementEntity { |
280 | | - #[serde(with = "common_domain::ids::string_serde")] |
281 | | - pub id: PlanVersionId, |
282 | | -} |
283 | | - |
284 | | -#[derive(Serialize, Deserialize, Debug, Clone, ToSchema)] |
285 | | -pub struct AddOnEntitlementEntity { |
286 | | - #[serde(with = "common_domain::ids::string_serde")] |
287 | | - pub id: AddOnId, |
288 | | -} |
289 | | - |
290 | | -#[derive(Serialize, Deserialize, Debug, Clone, ToSchema)] |
291 | | -pub struct SubscriptionEntitlementEntity { |
292 | | - #[serde(with = "common_domain::ids::string_serde")] |
293 | | - pub id: SubscriptionId, |
294 | | -} |
295 | | - |
296 | | -#[derive(Serialize, Deserialize, Debug, Clone, ToSchema)] |
297 | | -pub struct QuoteEntitlementEntity { |
298 | | - #[serde(with = "common_domain::ids::string_serde")] |
299 | | - pub id: QuoteId, |
300 | | -} |
301 | | - |
302 | | -#[derive(Serialize, Deserialize, Debug, Clone, ToSchema)] |
303 | | -#[serde(tag = "type", rename_all = "SCREAMING_SNAKE_CASE")] |
304 | | -pub enum EntitlementEntity { |
305 | | - Feature(FeatureEntitlementEntity), |
306 | | - Plan(PlanEntitlementEntity), |
307 | | - PlanVersion(PlanVersionEntitlementEntity), |
308 | | - AddOn(AddOnEntitlementEntity), |
309 | | - Subscription(SubscriptionEntitlementEntity), |
310 | | - Quote(QuoteEntitlementEntity), |
311 | | -} |
312 | | - |
313 | 263 | #[derive(Serialize, Debug, Clone, ToSchema)] |
314 | 264 | pub struct Feature { |
315 | 265 | #[serde(serialize_with = "string_serde::serialize")] |
@@ -367,30 +317,18 @@ pub struct FeatureRef { |
367 | 317 | pub struct EffectiveEntitlement { |
368 | 318 | pub feature: FeatureRef, |
369 | 319 | pub value: EffectiveEntitlementValue, |
370 | | - /// Highest-priority entity that contributed to the final value, with its human-readable name. |
371 | | - pub origin: ResolvedOrigin, |
372 | 320 | } |
373 | 321 |
|
374 | 322 | #[derive(Serialize, Debug, Clone, ToSchema)] |
375 | 323 | pub struct EffectiveEntitlementListResponse { |
376 | 324 | pub data: Vec<EffectiveEntitlement>, |
377 | 325 | } |
378 | 326 |
|
379 | | -/// Resolved entity that contributed the winning entitlement value, with a human-readable label. |
380 | | -#[derive(Serialize, Debug, Clone, ToSchema)] |
381 | | -pub struct ResolvedOrigin { |
382 | | - pub entity: EntitlementEntity, |
383 | | - #[serde(skip_serializing_if = "Option::is_none")] |
384 | | - pub name: Option<String>, |
385 | | -} |
386 | | - |
387 | 327 | /// Merged entitlement value for a feature across the priority hierarchy, without usage data. |
388 | 328 | #[derive(Serialize, Debug, Clone, ToSchema)] |
389 | 329 | pub struct ResolvedEntitlement { |
390 | 330 | pub feature: FeatureRef, |
391 | 331 | pub value: ResolvedEntitlementValue, |
392 | | - /// Highest-priority entity that contributed to the final value, with its human-readable name. |
393 | | - pub origin: ResolvedOrigin, |
394 | 332 | } |
395 | 333 |
|
396 | 334 | #[derive(Serialize, Debug, Clone, ToSchema)] |
|
0 commit comments