use tauri::{command, AppHandle, Runtime};
use crate::models::*;
use crate::HealthkitExt;
use crate::Result;
#[command]
pub(crate) async fn get_status<R: Runtime>(app: AppHandle<R>) -> Result<StatusResponse> {
app.healthkit().get_status()
}
#[command]
pub(crate) async fn check_permissions<R: Runtime>(
app: AppHandle<R>,
) -> Result<PermissionsResponse> {
app.healthkit().check_permissions()
}
#[command]
pub(crate) async fn request_permissions<R: Runtime>(
app: AppHandle<R>,
payload: PermissionsRequest,
) -> Result<PermissionsResponse> {
app.healthkit().request_permissions(payload)
}
#[command]
pub(crate) async fn open_settings<R: Runtime>(app: AppHandle<R>) -> Result<()> {
app.healthkit().open_settings()
}
#[command]
pub(crate) async fn open_play_store<R: Runtime>(app: AppHandle<R>) -> Result<()> {
app.healthkit().open_play_store()
}
#[command]
pub(crate) async fn get_step<R: Runtime>(
app: AppHandle<R>,
payload: StepDataRequest,
) -> Result<StepResponse> {
app.healthkit().get_step(payload)
}
#[command]
pub(crate) async fn get_sleep<R: Runtime>(
app: AppHandle<R>,
payload: SleepDataRequest,
) -> Result<SleepResponse> {
app.healthkit().get_sleep(payload)
}
#[command]
pub(crate) async fn get_weight<R: Runtime>(
app: AppHandle<R>,
payload: WeightDataRequest,
) -> Result<WeightResponse> {
app.healthkit().get_weight(payload)
}