<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Model;

class MetaAdsData extends Model
{
    protected $table = 'tenant_fb_ads_metrics';

    protected $fillable = [
        'tenant_id', 'date_preset',
        'spend', 'impressions', 'clicks', 'purchases',
        'roas', 'ctr', 'cpc',
        'raw_data_json', 'ai_analysis_report',
        'analyzed_at',
    ];

    protected $casts = [
        'raw_data_json'   => 'array',
        'analyzed_at'     => 'datetime',
        'spend'           => 'float',
        'roas'            => 'float',
        'ctr'             => 'float',
        'cpc'             => 'float',
    ];

    public function tenant()
    {
        return $this->belongsTo(Tenant::class);
    }
}
