<?php
// includes/auth.php — shared login/logout helpers
require_once __DIR__ . '/config.php';

/* ── CLIENT ────────────────────────────────────── */
function loginUser(array $user): void {
    $_SESSION['user_id']   = $user['id'];
    $_SESSION['user_name'] = $user['name'];
    $_SESSION['user_email']= $user['email'];
}
function logoutUser(): void {
    unset($_SESSION['user_id'], $_SESSION['user_name'], $_SESSION['user_email']);
}

/* ── LAWYER ────────────────────────────────────── */
function loginLawyer(array $lawyer): void {
    $_SESSION['lawyer_id']    = $lawyer['id'];
    $_SESSION['lawyer_name']  = $lawyer['name'];
    $_SESSION['lawyer_email'] = $lawyer['email'];
}
function logoutLawyer(): void {
    unset($_SESSION['lawyer_id'], $_SESSION['lawyer_name'], $_SESSION['lawyer_email']);
}
