<?php
require_once __DIR__ . '/../lib.php';
hw_require_auth(['client']);

$authUser = hw_get_auth_user();
$db = hw_db();

// Check if user has paid membership
$stmt = $db->prepare("SELECT id FROM user_memberships WHERE user_id = ? AND status = 'active' AND expires_at > NOW()");
$stmt->execute([$authUser['id']]);
$membership = $stmt->fetch();

hw_json([
    'hasPaidMembership' => $membership !== false,
    'membershipStatus' => $membership ? 'active' : 'inactive'
]);
?>