<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Model;

class Transfer extends Model
{
    protected $fillable = [
        'sender_name',
        'sender_phone',
        'recipient_name',
        'recipient_phone',
        'amount',
        'currency',
        'status',
        'type',
        'notes',
        'created_by',
        'service_id',
    ];

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

    public function service()
    {
        return $this->belongsTo(Service::class);
    }

    public function getTypeLabelAttribute(): string
    {
        return $this->type === 'incoming' ? 'واردة' : 'صادرة';
    }
}
