use bone_types::{Plane3, SketchEntityId};

use crate::curve2::Curve2Kind;

#[derive(Copy, Clone, Debug, PartialEq)]
pub struct ProfileEdge {
    curve: Curve2Kind,
    curve_entity: SketchEntityId,
    corner: SketchEntityId,
}

impl ProfileEdge {
    #[must_use]
    pub const fn new(
        curve: Curve2Kind,
        curve_entity: SketchEntityId,
        corner: SketchEntityId,
    ) -> Self {
        Self {
            curve,
            curve_entity,
            corner,
        }
    }

    #[must_use]
    pub const fn curve(self) -> Curve2Kind {
        self.curve
    }

    #[must_use]
    pub const fn curve_entity(self) -> SketchEntityId {
        self.curve_entity
    }

    #[must_use]
    pub const fn corner(self) -> SketchEntityId {
        self.corner
    }
}

#[derive(Clone, Debug, PartialEq)]
pub enum ProfileLoop {
    Closed {
        curve: Curve2Kind,
        curve_entity: SketchEntityId,
    },
    Open(Vec<ProfileEdge>),
}

#[derive(Clone, Debug, PartialEq)]
pub struct ExtrudeProfile {
    plane: Plane3,
    loops: Vec<ProfileLoop>,
}

impl ExtrudeProfile {
    #[must_use]
    pub fn new(plane: Plane3, loops: Vec<ProfileLoop>) -> Self {
        Self { plane, loops }
    }

    #[must_use]
    pub fn plane(&self) -> Plane3 {
        self.plane
    }

    #[must_use]
    pub fn loops(&self) -> &[ProfileLoop] {
        &self.loops
    }
}
