use bon::Builder;
use parse_display::{Display, FromStr};
use schemars::JsonSchema;
use serde::{Deserialize, Serialize};
use crate::coord;
pub mod import {
use super::*;
#[derive(Clone, Debug, Eq, Hash, PartialEq, Serialize, Deserialize, JsonSchema, Builder)]
#[serde(default, rename = "StepImportOptions")]
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
#[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))]
#[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
#[cfg_attr(
feature = "python",
pyo3_stub_gen::derive::gen_stub_pyclass,
pyo3::pyclass(name = "StepImportOptions")
)]
#[cfg_attr(not(feature = "unstable_exhaustive"), non_exhaustive)]
pub struct Options {
#[builder(default = *coord::KITTYCAD)]
pub coords: coord::System,
#[builder(default)]
pub split_closed_faces: bool,
}
#[cfg(feature = "python")]
#[pyo3_stub_gen::derive::gen_stub_pymethods]
#[pyo3::pymethods]
impl Options {
#[new]
pub fn new() -> Self {
Default::default()
}
}
impl Default for Options {
fn default() -> Self {
Self {
coords: *coord::KITTYCAD,
split_closed_faces: false,
}
}
}
}
pub mod export {
use super::*;
use crate::units::UnitLength;
#[derive(
Default, Clone, Copy, Debug, Eq, Hash, PartialEq, Serialize, Deserialize, JsonSchema, Display, FromStr,
)]
#[display(style = "snake_case")]
#[serde(rename = "StepPresentation", rename_all = "snake_case")]
#[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))]
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
#[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
#[cfg_attr(
feature = "python",
pyo3_stub_gen::derive::gen_stub_pyclass_enum,
pyo3::pyclass(name = "StepPresentation")
)]
#[cfg_attr(not(feature = "unstable_exhaustive"), non_exhaustive)]
pub enum Presentation {
Compact,
#[default]
Pretty,
}
#[derive(Clone, Debug, Deserialize, Eq, Hash, JsonSchema, PartialEq, Serialize, Builder)]
#[serde(default, rename = "StepExportOptions")]
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
#[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))]
#[cfg_attr(
feature = "python",
pyo3_stub_gen::derive::gen_stub_pyclass,
pyo3::pyclass(name = "StepExportOptions")
)]
#[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
#[cfg_attr(not(feature = "unstable_exhaustive"), non_exhaustive)]
pub struct Options {
#[builder(default = default_coords())]
pub coords: coord::System,
pub created: Option<chrono::DateTime<chrono::Utc>>,
#[builder(default = default_units())]
pub units: UnitLength,
#[builder(default = default_presentation())]
pub presentation: Presentation,
}
#[cfg(feature = "python")]
#[pyo3_stub_gen::derive::gen_stub_pymethods]
#[pyo3::pymethods]
impl Options {
#[new]
pub fn new() -> Self {
Default::default()
}
}
impl Default for Options {
fn default() -> Self {
Self {
coords: default_coords(),
created: None,
units: default_units(),
presentation: default_presentation(),
}
}
}
const fn default_presentation() -> Presentation {
Presentation::Pretty
}
const fn default_coords() -> coord::System {
*coord::KITTYCAD
}
const fn default_units() -> UnitLength {
UnitLength::Meters
}
}