<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Model;

class TradingSymbol extends Model
{
    protected $fillable = [
        'symbol',
        'display_name',
        'category',
        'base_currency',
        'quote_currency',
        'contract_size',
        'pip_size',
        'default_price',
        'is_active',
    ];

    protected function casts(): array
    {
        return [
            'contract_size' => 'decimal:4',
            'pip_size' => 'decimal:6',
            'default_price' => 'decimal:6',
            'is_active' => 'boolean',
        ];
    }

    public function scopeActive($query)
    {
        return $query->where('is_active', true);
    }
}
