<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\SoftDeletes;
use App\Models\Currencies;
use App\Models\Payment;
use App\Traits\Auditable;

class MedicalServiceSnapshot extends Model
{
    use SoftDeletes;
    use Auditable;

    /**
     * The "type" of the auto-incrementing ID.
     * 
     * @var string
     */
    protected $keyType = 'string';

    protected $table = 'medical_services_snapshot';

    /**
     * Indicates if the IDs are auto-incrementing.
     * 
     * @var bool
     */
    public $incrementing = false;

    protected $fillable = [
        'id',
        'name',
        'description',
        'cost',
        'currency_id',
        'is_active'
    ];

    protected $casts = [
        'cost' => 'decimal:2',
        'is_active' => 'boolean'
    ];

    public function currency()
    {
        return $this->belongsTo('App\Models\Currencies', 'currency_id');
    }

    public function payments()
    {
        return $this->belongsToMany(Payment::class, 'payment_medical_service', 'medical_service_id', 'payment_id')
            ->withTimestamps();
    }
} 