<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
use Spatie\MediaLibrary\HasMedia;
use Spatie\MediaLibrary\InteractsWithMedia;
use Swindon\FilamentHashids\Traits\HasHashid;

class CooperationPayment extends Model implements HasMedia
{
    use HasFactory, HasHashid, InteractsWithMedia;

    protected $guarded = ['id'];

    protected function casts(): array
    {
        return [
            'amount' => 'integer',
            'payment_date' => 'date',
            'cooperation_media_id' => 'integer',
        ];
    }

    public function cooperationMedia(): BelongsTo
    {
        return $this->belongsTo(CooperationMedia::class);
    }
}
