use crate::{Color, Pixels};
#[derive(Debug, Clone, Copy, PartialEq, Default)]
pub struct Border {
        pub color: Color,
        pub width: f32,
        pub radius: Radius,
}
pub fn rounded(radius: impl Into<Radius>) -> Border {
    Border::default().rounded(radius)
}
pub fn color(color: impl Into<Color>) -> Border {
    Border::default().color(color)
}
pub fn width(width: impl Into<Pixels>) -> Border {
    Border::default().width(width)
}
impl Border {
        pub fn color(self, color: impl Into<Color>) -> Self {
        Self {
            color: color.into(),
            ..self
        }
    }
        pub fn rounded(self, radius: impl Into<Radius>) -> Self {
        Self {
            radius: radius.into(),
            ..self
        }
    }
        pub fn width(self, width: impl Into<Pixels>) -> Self {
        Self {
            width: width.into().0,
            ..self
        }
    }
}
#[derive(Debug, Clone, Copy, PartialEq, Default)]
pub struct Radius {
        pub top_left: f32,
        pub top_right: f32,
        pub bottom_right: f32,
        pub bottom_left: f32,
}
pub fn radius(value: impl Into<Pixels>) -> Radius {
    Radius::new(value)
}
pub fn top_left(value: impl Into<Pixels>) -> Radius {
    Radius::default().top_left(value)
}
pub fn top_right(value: impl Into<Pixels>) -> Radius {
    Radius::default().top_right(value)
}
pub fn bottom_right(value: impl Into<Pixels>) -> Radius {
    Radius::default().bottom_right(value)
}
pub fn bottom_left(value: impl Into<Pixels>) -> Radius {
    Radius::default().bottom_left(value)
}
pub fn top(value: impl Into<Pixels>) -> Radius {
    Radius::default().top(value)
}
pub fn bottom(value: impl Into<Pixels>) -> Radius {
    Radius::default().bottom(value)
}
pub fn left(value: impl Into<Pixels>) -> Radius {
    Radius::default().left(value)
}
pub fn right(value: impl Into<Pixels>) -> Radius {
    Radius::default().right(value)
}
impl Radius {
        pub fn new(value: impl Into<Pixels>) -> Self {
        let value = value.into().0;
        Self {
            top_left: value,
            top_right: value,
            bottom_right: value,
            bottom_left: value,
        }
    }
        pub fn top_left(self, value: impl Into<Pixels>) -> Self {
        Self {
            top_left: value.into().0,
            ..self
        }
    }
        pub fn top_right(self, value: impl Into<Pixels>) -> Self {
        Self {
            top_right: value.into().0,
            ..self
        }
    }
        pub fn bottom_right(self, value: impl Into<Pixels>) -> Self {
        Self {
            bottom_right: value.into().0,
            ..self
        }
    }
        pub fn bottom_left(self, value: impl Into<Pixels>) -> Self {
        Self {
            bottom_left: value.into().0,
            ..self
        }
    }
        pub fn top(self, value: impl Into<Pixels>) -> Self {
        let value = value.into().0;
        Self {
            top_left: value,
            top_right: value,
            ..self
        }
    }
        pub fn bottom(self, value: impl Into<Pixels>) -> Self {
        let value = value.into().0;
        Self {
            bottom_left: value,
            bottom_right: value,
            ..self
        }
    }
        pub fn left(self, value: impl Into<Pixels>) -> Self {
        let value = value.into().0;
        Self {
            top_left: value,
            bottom_left: value,
            ..self
        }
    }
        pub fn right(self, value: impl Into<Pixels>) -> Self {
        let value = value.into().0;
        Self {
            top_right: value,
            bottom_right: value,
            ..self
        }
    }
}
impl From<f32> for Radius {
    fn from(radius: f32) -> Self {
        Self {
            top_left: radius,
            top_right: radius,
            bottom_right: radius,
            bottom_left: radius,
        }
    }
}
impl From<u8> for Radius {
    fn from(w: u8) -> Self {
        Self::from(f32::from(w))
    }
}
impl From<u16> for Radius {
    fn from(w: u16) -> Self {
        Self::from(f32::from(w))
    }
}
impl From<i32> for Radius {
    fn from(w: i32) -> Self {
        Self::from(w as f32)
    }
}
impl From<Radius> for [f32; 4] {
    fn from(radi: Radius) -> Self {
        [
            radi.top_left,
            radi.top_right,
            radi.bottom_right,
            radi.bottom_left,
        ]
    }
}