<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Model;

class RssFeed extends Model
{
    protected $fillable = [
        'name', 'feed_url', 'feed_logo', 'category_id', 'user_id',
        'is_active', 'fetch_full_content', 
        'is_rewrite_enabled', 'is_auto_category_enabled', 'rewrite_prompt', 
        'show_author',
        'posts_limit_per_crawl',
        'status_on_import', 'must_contain_keywords', 'must_not_contain_keywords',
        'last_crawled_at'
    ];

    protected $casts = [
        'is_active' => 'boolean',
        'fetch_full_content' => 'boolean',
        'is_rewrite_enabled' => 'boolean',
        'is_auto_category_enabled' => 'boolean', 
        'show_author' => 'boolean', 
        'must_contain_keywords' => 'array',
        'must_not_contain_keywords' => 'array',
        'last_crawled_at' => 'datetime',
    ];

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

    public function user()
    {
        return $this->belongsTo(User::class);
    }
}