use crate::bttask;
use crate::error::AppError;

#[tauri::command]
pub fn bttask_list(group_id: String) -> Result<Vec<bttask::Task>, AppError> {
    bttask::list_tasks(&group_id)
}

#[tauri::command]
pub fn bttask_comments(task_id: String) -> Result<Vec<bttask::TaskComment>, AppError> {
    bttask::task_comments(&task_id)
}

#[tauri::command]
pub fn bttask_update_status(task_id: String, status: String, version: i64) -> Result<i64, AppError> {
    bttask::update_task_status(&task_id, &status, version)
}

#[tauri::command]
pub fn bttask_add_comment(task_id: String, agent_id: String, content: String) -> Result<String, AppError> {
    bttask::add_comment(&task_id, &agent_id, &content)
}

#[tauri::command]
pub fn bttask_create(
    title: String,
    description: String,
    priority: String,
    group_id: String,
    created_by: String,
    assigned_to: Option<String>,
) -> Result<String, AppError> {
    bttask::create_task(&title, &description, &priority, &group_id, &created_by, assigned_to.as_deref())
        
}

#[tauri::command]
pub fn bttask_delete(task_id: String) -> Result<(), AppError> {
    bttask::delete_task(&task_id)
}

#[tauri::command]
pub fn bttask_review_queue_count(group_id: String) -> Result<i64, AppError> {
    bttask::review_queue_count(&group_id)
}
