diesel::table! {
    messages (id) {
        id -> Integer,
        session_id -> Integer,
        user -> Bool,
        reasoning -> Nullable<Text>,
        reasoning_complete -> Bool,
        content -> Text,
    }
}

diesel::table! {
    projects (id) {
        id -> Integer,
        name -> Text,
        path -> Text,
    }
}

diesel::table! {
    preferences (id) {
        id -> Integer,
        selected_model -> Text,
        dspark_enabled -> Bool,
        idle_timeout_minutes -> Integer,
        context_tokens -> Integer,
        max_generated_tokens -> Integer,
        system_prompt -> Text,
        temperature -> Nullable<Float>,
        top_p -> Nullable<Float>,
        min_p -> Nullable<Float>,
        seed -> Nullable<Text>,
        reasoning_mode -> Text,
        cpu_threads -> Nullable<Integer>,
        power_percent -> Nullable<Integer>,
        prefill_chunk -> Nullable<Integer>,
        quality -> Bool,
        warm_weights -> Bool,
        mtp_draft_tokens -> Integer,
        mtp_margin -> Float,
        glm_mtp -> Bool,
        glm_mtp_timing -> Bool,
        dspark_confidence_threshold -> Nullable<Float>,
        dspark_strict -> Bool,
        ssd_streaming -> Bool,
        ssd_streaming_cold -> Bool,
        ssd_cache_experts -> Nullable<BigInt>,
        ssd_cache_gib -> Nullable<BigInt>,
        ssd_full_layers -> Nullable<Integer>,
        ssd_preload_experts -> Nullable<Integer>,
        directional_steering_file -> Nullable<Text>,
        directional_steering_ffn -> Nullable<Float>,
        directional_steering_attn -> Nullable<Float>,
        simulated_used_memory_gib -> Nullable<BigInt>,
        expert_profile_path -> Nullable<Text>,
        endpoint_port -> Integer,
    }
}

diesel::table! {
    sessions (id) {
        id -> Integer,
        project_id -> Integer,
        title -> Text,
        context_used -> Integer,
        context_limit -> Integer,
        last_tokens_per_second -> Nullable<Float>,
        state -> Text,
    }
}

diesel::joinable!(sessions -> projects (project_id));
diesel::joinable!(messages -> sessions (session_id));
diesel::allow_tables_to_appear_in_same_query!(messages, preferences, projects, sessions);
