<?php
include_once "../config/database.php";
include_once "../resources/manageusers.php";
include_once "../resources/EncryptDecrypt.php";

if ($_SERVER["REQUEST_METHOD"] === "POST" && isset($_POST["company_id"])) {
    $companyId = intval($_POST["company_id"]);

    $object = new ManageUsers();
    $rules = $object->GetPasswordRules($companyId);

    if ($rules) {
        echo json_encode(["success" => true, "rules" => $rules]);
    } else {
        echo json_encode(["success" => false, "message" => "Failed to fetch rules"]);
    }
} else {
    echo json_encode(["success" => false, "message" => "Invalid request"]);
}
?>
