// @generated by libremetaverse-codegen; DO NOT EDIT.
// Regenerate: cargo run -p libremetaverse-codegen -- generate
// Generator: attentions
// Source: codegen/inputs/attentions.xml sha256=bdbc4ca02dd3bde78b86e796f7eb4ada0000e47be9a127e35d2b77f3010a20af license=BSD-3-Clause
// Source: codegen/inputs/attentionsN.xml sha256=80055e12a04d05ef5bb16e8c542cd6c218735f8c72f7e48317b8a34282d1ac5b license=BSD-3-Clause

#![allow(
    clippy::missing_errors_doc,
    clippy::must_use_candidate,
    clippy::should_implement_trait
)]
use std::sync::OnceLock;
#[derive(Clone, Debug, Default, PartialEq)]
pub struct AttentionData {
    priority: f32,
    timeout: f32,
}
impl AttentionData {
    pub fn priority(&self) -> f32 {
        self.priority
    }
    pub fn set_priority(&mut self, value: f32) {
        self.priority = value;
    }
    pub fn timeout(&self) -> f32 {
        self.timeout
    }
    pub fn set_timeout(&mut self, value: f32) {
        self.timeout = value;
    }
}
#[derive(Clone, Debug, Default, PartialEq)]
pub struct AttentionSet {
    name: String,
    entries: Vec<AttentionData>,
}
impl AttentionSet {
    pub fn get(&self, type_: crate::LookAtType) -> Result<AttentionData, crate::Error> {
        self.entries.get(type_ as usize).cloned().ok_or(crate::Error::IndexOutOfRange)
    }
    pub fn entries(&self) -> Vec<AttentionData> {
        self.entries.clone()
    }
    pub fn set_entries(&mut self, value: Vec<AttentionData>) {
        self.entries = value;
    }
    pub fn name(&self) -> String {
        self.name.clone()
    }
    pub fn set_name(&mut self, value: String) {
        self.name = value;
    }
}
fn default_sets() -> &'static [AttentionSet] {
    static SETS: OnceLock<Vec<AttentionSet>> = OnceLock::new();
    SETS.get_or_init(|| {
            vec![
                AttentionSet { name : "Masculine".to_owned(), entries :
                vec![AttentionData { priority : 0.0_f32, timeout : 0.0_f32 },
                AttentionData { priority : 1.0_f32, timeout : 3.0_f32 }, AttentionData {
                priority : 3.0_f32, timeout : 4.0_f32 }, AttentionData { priority :
                2.0_f32, timeout : 2.0_f32 }, AttentionData { priority : 3.0_f32, timeout
                : 4.0_f32 }, AttentionData { priority : 4.0_f32, timeout : 1.0_f32 },
                AttentionData { priority : 0.0_f32, timeout : - 1.0_f32 }, AttentionData
                { priority : 6.0_f32, timeout : - 1.0_f32 }, AttentionData { priority :
                6.0_f32, timeout : - 1.0_f32 }, AttentionData { priority : 7.0_f32,
                timeout : - 1.0_f32 }, AttentionData { priority : 0.0_f32, timeout :
                0.0_f32 }] }, AttentionSet { name : "Feminine".to_owned(), entries :
                vec![AttentionData { priority : 0.0_f32, timeout : 0.0_f32 },
                AttentionData { priority : 1.0_f32, timeout : 3.0_f32 }, AttentionData {
                priority : 3.0_f32, timeout : 4.0_f32 }, AttentionData { priority :
                2.0_f32, timeout : 2.0_f32 }, AttentionData { priority : 3.0_f32, timeout
                : 4.0_f32 }, AttentionData { priority : 4.0_f32, timeout : 1.0_f32 },
                AttentionData { priority : 0.0_f32, timeout : - 1.0_f32 }, AttentionData
                { priority : 6.0_f32, timeout : - 1.0_f32 }, AttentionData { priority :
                6.0_f32, timeout : - 1.0_f32 }, AttentionData { priority : 7.0_f32,
                timeout : - 1.0_f32 }, AttentionData { priority : 0.0_f32, timeout :
                0.0_f32 }] }
            ]
        })
        .as_slice()
}
fn updated_sets() -> &'static [AttentionSet] {
    static SETS: OnceLock<Vec<AttentionSet>> = OnceLock::new();
    SETS.get_or_init(|| {
            vec![
                AttentionSet { name : "Masculine".to_owned(), entries :
                vec![AttentionData { priority : 0.0_f32, timeout : 0.0_f32 },
                AttentionData { priority : 1.0_f32, timeout : 3.0_f32 }, AttentionData {
                priority : 3.0_f32, timeout : 4.0_f32 }, AttentionData { priority :
                2.0_f32, timeout : 2.0_f32 }, AttentionData { priority : 3.0_f32, timeout
                : 3.0_f32 }, AttentionData { priority : 4.0_f32, timeout : 1.0_f32 },
                AttentionData { priority : 5.0_f32, timeout : 3.0_f32 }, AttentionData {
                priority : 3.5_f32, timeout : - 1.0_f32 }, AttentionData { priority :
                3.5_f32, timeout : 20.0_f32 }, AttentionData { priority : 7.0_f32,
                timeout : - 1.0_f32 }, AttentionData { priority : 0.0_f32, timeout :
                0.0_f32 }] }, AttentionSet { name : "Feminine".to_owned(), entries :
                vec![AttentionData { priority : 0.0_f32, timeout : 0.0_f32 },
                AttentionData { priority : 1.0_f32, timeout : 3.0_f32 }, AttentionData {
                priority : 3.0_f32, timeout : 4.0_f32 }, AttentionData { priority :
                2.0_f32, timeout : 2.0_f32 }, AttentionData { priority : 3.0_f32, timeout
                : 6.0_f32 }, AttentionData { priority : 4.0_f32, timeout : 1.0_f32 },
                AttentionData { priority : 5.0_f32, timeout : 6.0_f32 }, AttentionData {
                priority : 2.5_f32, timeout : - 1.0_f32 }, AttentionData { priority :
                2.5_f32, timeout : 10.0_f32 }, AttentionData { priority : 7.0_f32,
                timeout : - 1.0_f32 }, AttentionData { priority : 0.0_f32, timeout :
                0.0_f32 }] }
            ]
        })
        .as_slice()
}
pub struct LindenAttentions;
impl LindenAttentions {
    pub fn default() -> Vec<AttentionSet> {
        default_sets().to_vec()
    }
    pub fn updated() -> Vec<AttentionSet> {
        updated_sets().to_vec()
    }
    pub fn default_masculine() -> AttentionSet {
        default_sets()[0].clone()
    }
    pub fn default_feminine() -> AttentionSet {
        default_sets()[1].clone()
    }
    pub fn updated_masculine() -> AttentionSet {
        updated_sets()[0].clone()
    }
    pub fn updated_feminine() -> AttentionSet {
        updated_sets()[1].clone()
    }
}
#[cfg(test)]
mod tests {
    use super::*;
    #[test]
    fn generated_attention_shape() {
        assert_eq!(default_sets().len(), 2);
        assert_eq!(updated_sets().len(), 2);
        assert!(
            default_sets().iter().chain(updated_sets()).all(| set | set.entries.len() ==
            11)
        );
        assert_eq!(default_sets() [0].name, "Masculine");
        assert_eq!(default_sets() [1].name, "Feminine");
    }
}
