<?php

declare(strict_types=1);

namespace Plugin\tnt_stabila_shop\src\Models;

use Plugin\tnt_stabila_shop\src\Abstracts\AbstractModel;

class Notifications extends AbstractModel
{
    public static function getTable(): string
    {
        return 'stabila_shop_notifications';
    }

    /**
     * @return array{
     *     hash: 'string',
     *     type: 'int',
     *     title: 'string',
     *     description: 'string',
     *     createDate: 'datetime'
     * }
     */
    public static function getSchema(): array
    {
        return [
            'hash'        => 'string',
            'type'        => 'int',
            'title'       => 'string',
            'description' => 'string',
            'createDate'  => 'datetime',
        ];
    }

    public static function generateHash(int $notificationType, string $description): string
    {
        return 'stabila_' . \md5($notificationType . '_' . $description);
    }
}
