dpp-domain 0.20.0

EU Digital Product Passport domain types, port traits, and per-field disclosure policy
Documentation
//! Iron & Steel (EU ESPR, carbon intensity).

use serde::{Deserialize, Serialize};

use crate::identifier::Gtin;
use crate::product_group::ProductionRoute;

/// Iron and Steel product group data for EU ESPR carbon intensity reporting.
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
#[serde(rename_all = "camelCase")]
pub struct SteelData {
    /// 14-digit GTIN identifying the steel product.
    pub gtin: Gtin,
    /// Carbon intensity in tonne CO₂e per tonne of steel produced.
    pub co2e_per_tonne_steel: f64,
    /// Recycled scrap content as a percentage of total input material (0.0–100.0).
    pub recycled_scrap_content_pct: f64,
    /// Steel grade / product category, e.g. `"flat"`, `"long"`, `"tube"`.
    pub product_category: String,
    /// ISO 3166-1 alpha-2 country of production.
    pub country_of_origin: String,
    /// Steel production route — determines carbon intensity calculation basis.
    pub production_route: ProductionRoute,
    /// Annual production volume in tonnes (optional).
    #[serde(skip_serializing_if = "Option::is_none")]
    pub annual_production_tonnes: Option<f64>,
}

impl crate::product_group::payload::ProductGroupPayload for SteelData {
    fn gtin(&self) -> Option<&str> {
        Some(self.gtin.as_str())
    }

    /// This act defines no model identifier.
    fn model_identifier(&self) -> Option<&str> {
        None
    }

    /// This act's schema declares no substances-of-concern field.
    fn svhc_substances(&self) -> Option<&[crate::product_group::SvhcSubstance]> {
        None
    }

    /// The steel grade. Constrained by the `productCategory` enum in this
    /// group's schema rather than by the Rust type, which is the same guarantee
    /// every other validated string field has.
    fn product_category(&self) -> Option<&str> {
        Some(&self.product_category)
    }
}