<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;

class CryptoAccount extends Model
{
    use HasFactory;

    protected $fillable = [
        'finance_group_id',
        'crypto_coin_id',
        'address',
        'is_active',
        'created_by',
    ];

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

    public function financeGroup()
    {
        return $this->belongsTo(FinanceGroup::class);
    }

    public function coin()
    {
        return $this->belongsTo(CryptoCoin::class, 'crypto_coin_id');
    }

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

