<?php

declare(strict_types=1);

namespace BeycanPress\Tokenico\Models;

use BeycanPress\Tokenico\PluginHero\Model\AbstractModel;

class Sale extends AbstractModel
{
    /**
     * @var string
     */
    public string $tableName = 'tokenico_sale';

    /**
     * @var string
     */
    public string $version = '1.0.1';

    /**
     * Sale constructor.
     */
    public function __construct()
    {
        parent::__construct([
            'transactionHash' => [
                'type' => 'string',
                'length' => 250,
                'index' => [
                    'type' => 'unique'
                ]
            ],
            'userId' => [
                'type' => 'bigint',
            ],
            'transactionUrl' => [
                'type' => 'text'
            ],
            'presaleKey' => [
                'type' => 'text',
            ],
            'networkId' => [
                'type' => 'text'
            ],
            'token' => [
                'type' => 'text'
            ],
            'nativeCurrency' => [
                'type' => 'string',
                'length' => 10,
            ],
            'receiverAddress' => [
                'type' => 'text'
            ],
            'receiverAddressUrl' => [
                'type' => 'text'
            ],
            'tokenAmount' => [
                'type' => 'float',
            ],
            'purchaseAmount' => [
                'type' => 'float',
            ],
            'createdAt' => [
                'type' => 'bigint'
            ],
            'premium' => [
                'type' => 'boolean',
                'default' => false,
            ],
        ]);
    }
}
