Skip to main content

systemprompt_models/feedback/
inventory.rs

1//! Consumer inventory inputs: where a skill came from, whether it is available,
2//! and how a consumer is a member of the managed catalogue.
3//!
4//! Copyright (c) systemprompt.io — Business Source License 1.1.
5//! See <https://systemprompt.io> for licensing details.
6
7use chrono::{DateTime, Utc};
8use serde::{Deserialize, Serialize};
9use systemprompt_identifiers::{InventoryEntryId, ManagedResourceId, ManagedSourceId, UserId};
10
11#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize, schemars::JsonSchema)]
12#[serde(rename_all = "snake_case")]
13pub enum InventoryOrigin {
14    Configured,
15    Managed,
16    Imported,
17}
18
19#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize, schemars::JsonSchema)]
20#[serde(rename_all = "snake_case")]
21pub enum InventoryAvailability {
22    Available,
23    Unavailable,
24    Withdrawn,
25    Conflicting,
26}
27
28#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize, schemars::JsonSchema)]
29#[serde(deny_unknown_fields)]
30pub struct InventoryInput {
31    pub entry_id: InventoryEntryId,
32    pub organization_owner_id: UserId,
33    pub origin: InventoryOrigin,
34    pub configured_key: Option<String>,
35    pub resource_id: Option<ManagedResourceId>,
36    pub source_id: Option<ManagedSourceId>,
37    pub availability: InventoryAvailability,
38    pub observed_at: DateTime<Utc>,
39}
40
41#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize, schemars::JsonSchema)]
42#[serde(tag = "status", rename_all = "snake_case")]
43pub enum InventoryMembership {
44    Known {
45        effective_from: DateTime<Utc>,
46        effective_until: Option<DateTime<Utc>>,
47    },
48    Unknown,
49}