<?php

namespace Hubleto\App\Community\Orders\Models;

use Hubleto\Framework\Db\Column\Lookup;
use Hubleto\Framework\Db\Column\Varchar;
use Hubleto\Framework\Db\Column\Text;
use Hubleto\Framework\Db\Column\DateTime;
class History extends \Hubleto\Erp\Model
{
  public string $table = 'order_histories';
  public string $recordManagerClass = RecordManagers\History::class;
  public ?string $lookupSqlValue = '{%TABLE%}.id';

  public array $relations = [
    'ORDER' => [ self::BELONGS_TO, Order::class, 'id_order', 'id'],
  ];

  public function describeColumns(): array
  {
    return array_merge(parent::describeColumns(), [
      'id_order' => (new Lookup($this, $this->translate("Order"), Order::class))->setRequired()->setReadonly(),
      'short_description' => (new Varchar($this, $this->translate("Short Description")))->setReadonly(),
      'long_description' => (new Text($this, $this->translate("Long Description")))->setReadonly(),
      'date_time' => (new DateTime($this, $this->translate("Date Time")))->setRequired()->setReadonly(),
    ]);
  }
}
