<?php

namespace App\Models;

use Database\Factories\KeywordFactory;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
use Illuminate\Support\Carbon;

/**
 * @property int $id
 * @property int $feed_id
 * @property Feed $feed
 * @property int $platform_channel_id
 * @property PlatformChannel $platformChannel
 * @property string $keyword
 * @property bool $is_active
 * @property Carbon $created_at
 * @property Carbon $updated_at
 */
class Keyword extends Model
{
    /** @use HasFactory<KeywordFactory> */
    use HasFactory;

    protected $fillable = [
        'feed_id',
        'platform_channel_id',
        'keyword',
        'is_active',
    ];

    protected $casts = [
        'is_active' => 'boolean',
    ];

    /**
     * @return BelongsTo<Feed, $this>
     */
    public function feed(): BelongsTo
    {
        return $this->belongsTo(Feed::class);
    }

    /**
     * @return BelongsTo<PlatformChannel, $this>
     */
    public function platformChannel(): BelongsTo
    {
        return $this->belongsTo(PlatformChannel::class);
    }
}
