use std::borrow::Cow;

use quick_xml::{events::attributes::Attribute, name::QName};

use super::WriteElement;

/// [feGaussianBlur](https://www.w3.org/TR/SVG11/filters.html#feGaussianBlurElement)
#[derive(Debug)]
pub struct GaussianBlur {
    std_deviation: (u16, u16),
}

impl GaussianBlur {
    pub fn single(v: u16) -> Self {
        Self {
            std_deviation: (v, v),
        }
    }

    pub fn with_xy(x: u16, y: u16) -> Self {
        Self {
            std_deviation: (x, y),
        }
    }
}

impl WriteElement for GaussianBlur {
    fn attrs(&self) -> Vec<quick_xml::events::attributes::Attribute> {
        gen_attrs![b"stdDeviation": format!("{} {}", self.std_deviation.0, self.std_deviation.1)]
    }

    fn tag_name(&self) -> &'static str {
        "feGaussianBlur"
    }
}
