<?php

	use Reflect\{Response, Path};
	use Reflect\Rules\{Ruleset, Rules, Type};

	use VLW\API\API;
	use VLW\Helpers\UUID;
	use VLW\Database\Models\Coffee\Coffee;
	use VLW\Database\Tables\Coffee\Coffee as CoffeeTable;

	require_once Path::root("src/API/API.php");
	require_once Path::root("src/Database/Models/Coffee/Coffee.php");
	require_once Path::root("src/Database/Tables/Coffee/Coffee.php");

	final class DELETE_Coffee extends API {
		public function __construct() {
			parent::__construct(new Ruleset()->GET([
				new Rules(CoffeeTable::ID->value)
					->required()
					->type(Type::STRING)
					->min(UUID::LENGTH)
					->max(UUID::LENGTH)
			]));
		}

		public function main(): Response {
			return new Response(new Coffee($_GET[CoffeeTable::ID->value])->delete());
		}
	}