use std::collections::HashMap;

use alloc::borrow::Cow;
use serde::Deserialize;

#[derive(Clone, Debug, Deserialize)]
pub struct ExternalCodeSets<'a> {
    #[serde(borrow)]
    pub definitions: HashMap<&'a str, ExternalCodeSet<'a>>,
}

#[derive(Clone, Debug, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct ExternalCodeSet<'a> {
    #[serde(borrow)]
    pub description: Cow<'a, str>,

    pub min_length: Option<usize>,

    pub max_length: Option<usize>,

    pub pattern: Option<Cow<'a, str>>,

    #[serde(borrow, default, rename = "enum")]
    pub values: Vec<Cow<'a, str>>,
}