<?php
require_once __DIR__ . "/../auth/check-permission.php";
require_once __DIR__ . "/../services/db.php";

$data = json_decode(file_get_contents("php://input"), true);

requireProjectRole($conn, $data["project_id"], ["owner", "member"]);

$sql = "INSERT INTO tags (name, color)
        VALUES (?, ?)";
sqlsrv_query($conn, $sql, [
    $data["name"],
    $data["color"]
]);

echo json_encode(["success" => true]);
