use serde::{Deserialize, Serialize};
use wasm_bindgen::prelude::*;
#[derive(Debug, Clone, Serialize, Deserialize)]
#[wasm_bindgen]
pub struct SpecialLagnas {
pub hora_lagna: f64,
pub ghati_lagna: f64,
pub sree_lagna: f64,
}
pub fn calculate_special_lagnas(
birth_jd: f64,
sunrise_jd: f64,
sunrise_sun_long: f64,
lagna_long: f64,
moon_long: f64,
) -> SpecialLagnas {
let diff_days = birth_jd - sunrise_jd;
let diff_hours = diff_days * 24.0;
let hora_lagna = (sunrise_sun_long + diff_hours * 30.0) % 360.0;
let ghati_lagna = (sunrise_sun_long + diff_hours * 60.0) % 360.0;
let nk_span = 360.0 / 27.0;
let nk_portion = (moon_long % nk_span) / nk_span;
let sree_lagna = (lagna_long + nk_portion * 360.0) % 360.0;
SpecialLagnas {
hora_lagna,
ghati_lagna,
sree_lagna,
}
}