use bon::Builder;
use parse_display::{Display, FromStr};
use schemars::JsonSchema;
use serde::{Deserialize, Serialize};
use crate::{coord, format::Selection, units::UnitLength};
pub mod import {
use super::*;
#[derive(Clone, Debug, Eq, Hash, PartialEq, Serialize, Deserialize, JsonSchema, Builder)]
#[serde(rename = "StlImportOptions")]
#[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 = "StlImportOptions")
)]
#[cfg_attr(not(feature = "unstable_exhaustive"), non_exhaustive)]
pub struct Options {
#[builder(default = *coord::KITTYCAD)]
pub coords: coord::System,
#[builder(default = UnitLength::Millimeters)]
pub units: UnitLength,
}
#[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,
units: UnitLength::Millimeters,
}
}
}
}
pub mod export {
use super::*;
#[derive(Clone, Debug, Eq, Hash, PartialEq, Serialize, Deserialize, JsonSchema, Builder)]
#[serde(rename = "StlExportOptions")]
#[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 = "StlExportOptions")
)]
#[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
#[cfg_attr(not(feature = "unstable_exhaustive"), non_exhaustive)]
pub struct Options {
#[builder(default = *coord::KITTYCAD)]
pub coords: coord::System,
#[builder(default)]
pub selection: Selection,
#[builder(default)]
pub storage: Storage,
#[builder(default = UnitLength::Millimeters)]
pub units: UnitLength,
}
#[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,
selection: Default::default(),
storage: Default::default(),
units: UnitLength::Millimeters,
}
}
}
#[derive(
Clone, Copy, Debug, Default, Deserialize, Display, Eq, FromStr, Hash, JsonSchema, PartialEq, Serialize,
)]
#[display(style = "snake_case")]
#[serde(rename = "StlStorage", rename_all = "snake_case")]
#[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_enum,
pyo3::pyclass(name = "StlStorage")
)]
#[cfg_attr(not(feature = "unstable_exhaustive"), non_exhaustive)]
pub enum Storage {
Ascii,
#[default]
Binary,
}
}