<?php

namespace Planaday\Database\MySQL\QueryBuilding;

use Planaday\Database\Abstraction\SQLQuery\QueryBuilding\SQLDelete;
use Planaday\Database\Abstraction\SQLQuery\QueryBuilding\SQLTable;
use Planaday\Database\Abstraction\SQLQuery\QueryBuilding\SQLUseInterfaces\SQLCondition;

class MySQLDelete implements SQLDelete {
	public function __construct(
		protected SQLTable $table,
		protected SQLCondition $where
	) {}

	public function toQuery():string {
		return 'DELETE FROM ' . $this->table->getFromQuery() .
		       ' WHERE ' . $this->where->toConditionQuery();
	}
}