<?php

/**
 * Created by Reliese Model.
 */

namespace App\Models;

use Carbon\Carbon;
use Illuminate\Database\Eloquent\Collection;
use Illuminate\Database\Eloquent\Model;

/**
 * Class ShopeeSellerScrape
 *
 * @property int $id
 * @property int|null $category_id
 * @property string $seller
 * @property string $country_iso
 * @property int $epoch
 * @property string $filename
 * @property Carbon|null $created_at
 * @property Carbon|null $updated_at
 * @property Category|null $category
 * @property Collection|ShopeeSellerScrapedImage[] $shopee_seller_scraped_images
 */
class ShopeeSellerScrape extends Model
{
    protected $table = 'shopee_seller_scrapes';

    protected $casts = [
        'category_id' => 'int',
        'epoch' => 'int',
        'last_ai_written_at' => 'datetime',
        'write_counts' => 'int',
    ];

    protected $fillable = [
        'category_id',
        'seller',
        'country_iso',
        'epoch',
        'filename',
        'last_ai_written_at',
        'write_counts'
    ];

    public function category()
    {
        return $this->belongsTo(Category::class);
    }

    public function shopee_seller_scraped_images()
    {
        return $this->hasMany(ShopeeSellerScrapedImage::class);
    }
}
