<?php

declare(strict_types=1);

namespace Cycle\ORM\Schema;

/**
 * Values for {@see SchemaInterface::GENERATED_FIELDS}
 */
final class GeneratedField
{
    /**
     * Field value is generated in the user space before transaction running.
     */
    public const DEFAULT = 0;

    /**
     * Field value is generated by PHP code before Insert command running
     * like with `CreatedAt` or `Uuid` Entity Behaviors
     *
     * @link https://github.com/cycle/entity-behavior
     * @link https://github.com/cycle/entity-behavior-uuid
     */
    public const BEFORE_INSERT = 1;

    /**
     * Field value is generated by the Database.
     * It is: autoincrement fields, sequences, timestamps, etc.
     */
    public const ON_INSERT = 2;

    /**
     * Field value is generated by PHP code before Update command running like with `UpdatedAt` Entity Behavior.
     *
     * @link https://github.com/cycle/entity-behavior
     */
    public const BEFORE_UPDATE = 4;
}
