<?php

require_once __DIR__ . '/../app/auth.php';
require_once __DIR__ . '/../app/layout.php';
require_once __DIR__ . '/../app/pricing.php';

$user = sparrow_require_backyard_login();

if ($_SERVER['REQUEST_METHOD'] !== 'POST') {
    sparrow_redirect('/backyard/pricing.php');
}

$id = (int) ($_POST['delete_pricing_id'] ?? 0);

if ($id > 0) {
    sparrow_delete_pricing_row($id);
}

sparrow_redirect('/backyard/pricing.php?deleted=1');