Skip to main content

media_tools/models/
content_restrictions.rs

1//! Hard suitability constraints for an individual participant.
2use serde::{Deserialize, Serialize};
3
4use super::MediaProfileId;
5
6/// Restrictions applied before recommendation ranking, not soft preferences.
7#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
8#[serde(default)]
9pub struct ContentRestrictions {
10    pub profile_id: MediaProfileId,
11    /// Maximum certification accepted for this profile (provider-normalized value).
12    pub maximum_certification: Option<String>,
13    /// Explicitly prohibited content genres.
14    pub disallowed_genres: Vec<String>,
15    /// Explicitly prohibited themes matched against normalized title/overview metadata.
16    pub disallowed_themes: Vec<String>,
17    /// Whether titles without a known certification may pass the restriction check.
18    pub allow_unrated: bool,
19}
20
21impl ContentRestrictions {
22    pub fn new(profile_id: MediaProfileId) -> Self {
23        Self {
24            profile_id,
25            maximum_certification: None,
26            disallowed_genres: Vec::new(),
27            disallowed_themes: Vec::new(),
28            allow_unrated: false,
29        }
30    }
31}
32
33impl Default for ContentRestrictions {
34    fn default() -> Self {
35        Self::new(MediaProfileId::new())
36    }
37}