#![warn(missing_docs)]
#[allow(dead_code)]
pub(crate) mod bridge;
pub mod astro;
pub mod data;
pub mod dto;
pub mod error;
pub mod i18n;
pub mod models;
pub mod prompt;
pub mod star;
pub mod utils;
#[cfg(feature = "python")]
mod python;
#[doc(hidden)]
pub mod ffi;
#[cfg(target_arch = "wasm32")]
#[doc(hidden)]
pub mod wasm;
pub use astro::builder::{by_lunar, by_solar};
pub use astro::horoscope::get_horoscope;
pub use astro::palace::{get_five_elements_class, get_palace_names, get_soul_and_body};
pub use astro::query::{
get_major_star_by_lunar_date, get_major_star_by_solar_date, get_sign_by_lunar_date,
get_sign_by_solar_date, get_zodiac_by_solar_date,
};
pub use data::stars::StarKey;
pub use data::types::*;
pub use error::{BridgeError, IztroError};
pub use i18n::lookup::{key_of, key_of_in, translate_key};
pub use i18n::{
translate_brightness, translate_earthly_branch, translate_five_elements_class,
translate_gender, translate_heavenly_stem, translate_horoscope_name, translate_mutagen,
translate_palace, translate_sign, translate_star, translate_time, translate_zodiac,
};
pub use models::astrolabe::{
Astrolabe, PalaceRef, PalaceTarget, RawChineseDate, RawDates, RawLunarDate, StarRef,
};
pub use models::horoscope::{
AgeItem, HoroscopeData, HoroscopeItem, HoroscopeRef, YearlyDecStar, YearlyItem,
};
pub use models::palace::{Decadal, PalaceData};
pub use models::star::Star;
pub use models::surpalaces::SurroundedPalaces;
pub use prompt::{astrolabe_to_prompt, horoscope_to_prompt};
pub fn by_solar_json(
solar_date: &str,
time_index: u8,
gender: Gender,
fix_leap: bool,
language: Language,
config: Config,
) -> Result<String, IztroError> {
let astrolabe = by_solar(solar_date, time_index, gender, fix_leap, language, config)?;
Ok(serde_json::to_string(&astrolabe.to_dto())
.expect("DTO 只含字符串、数值与容器,序列化不会失败"))
}
pub fn by_lunar_json(
lunar_date: &str,
time_index: u8,
gender: Gender,
leap: LeapMonth,
language: Language,
config: Config,
) -> Result<String, IztroError> {
let astrolabe = by_lunar(lunar_date, time_index, gender, leap, language, config)?;
Ok(serde_json::to_string(&astrolabe.to_dto())
.expect("DTO 只含字符串、数值与容器,序列化不会失败"))
}