<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Model;

class CustomerQualityMetric extends Model
{
    protected $guarded = ['id'];

    protected $casts = [
        'total_orders' => 'integer',
        'delivered_orders' => 'integer',
        'returned_orders' => 'integer',
        'cancelled_orders' => 'integer',
        'delivered_amount' => 'float',
        'average_order_value' => 'float',
        'receive_rate' => 'float',
        'return_rate' => 'float',
        'cancel_rate' => 'float',
        'quality_score' => 'float',
        'lookalike_value' => 'float',
        'is_blacklisted' => 'boolean',
        'is_fake' => 'boolean',
        'is_blocked' => 'boolean',
        'is_internal' => 'boolean',
        'is_high_quality' => 'boolean',
        'is_high_return' => 'boolean',
        'is_high_cancel' => 'boolean',
        'classification_reasons' => 'array',
        'internal_exclusion_evidence' => 'array',
        'source_order_count' => 'integer',
        'calculated_at' => 'datetime',
        'created_at' => 'datetime',
        'updated_at' => 'datetime',
    ];

    public function customer()
    {
        return $this->belongsTo(User::class, 'user_id');
    }
}
