<?php
namespace Incoviba\Common\Define\Query\Create;

interface CreateDefinition
{
    const RESTRICT = 0;
    const CASCADE = 1;
    const SET_NULL = 2;
    const NO_ACTION = 3;
    const SET_DEFAULT = 4;

    /**
     * @param string $name
     * @return CreateDefinition
     */
    public function name(string $name): CreateDefinition;

    /**
     * @param string $type
     * @param int|null $size
     * @return CreateDefinition
     */
    public function type(string $type, ?int $size = null): CreateDefinition;

    /**
     * @return CreateDefinition
     */
    public function primary(): CreateDefinition;

    /**
     * @return CreateDefinition
     */
    public function autoIncrement(): CreateDefinition;

    /**
     * @return CreateDefinition
     */
    public function unsigned(): CreateDefinition;

    /**
     * @param mixed $value
     * @return CreateDefinition
     */
    public function default(mixed $value): CreateDefinition;

    /**
     * @param string $reference_table
     * @param string $reference_column
     * @param int $on_delete
     * @param int $on_update
     * @return CreateDefinition
     */
    public function foreign(string $reference_table, string $reference_column = 'id', int $on_delete = CreateDefinition::CASCADE, int $on_update = CreateDefinition::CASCADE): CreateDefinition;

    /**
     * @return string
     */
    public function __toString(): string;
}
