systemprompt-models 0.2.1

Foundation data models for systemprompt.io AI governance infrastructure. Shared DTOs, config, and domain types consumed by every layer of the MCP governance pipeline.
Documentation
use crate::artifacts::types::{Alignment, ColumnType};
use schemars::JsonSchema;
use serde::{Deserialize, Serialize};

#[derive(Debug, Clone, Serialize, Deserialize, JsonSchema)]
pub struct Column {
    pub name: String,
    #[serde(rename = "column_type")]
    pub kind: ColumnType,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub label: Option<String>,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub width: Option<usize>,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub align: Option<Alignment>,
}

impl Column {
    pub fn new(name: impl Into<String>, kind: ColumnType) -> Self {
        Self {
            name: name.into(),
            kind,
            label: None,
            width: None,
            align: None,
        }
    }

    pub fn with_header(mut self, header: impl Into<String>) -> Self {
        self.label = Some(header.into());
        self
    }

    pub fn with_label(self, label: impl Into<String>) -> Self {
        self.with_header(label)
    }

    pub const fn with_width(mut self, width: usize) -> Self {
        self.width = Some(width);
        self
    }

    pub const fn with_alignment(mut self, align: Alignment) -> Self {
        self.align = Some(align);
        self
    }

    pub fn name(&self) -> &str {
        &self.name
    }

    pub const fn column_type(&self) -> ColumnType {
        self.kind
    }
}