<?php

namespace App\Models;

use App\Models\Client\Client;
use App\Models\User\User;
use App\Trait\HasSlug;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsTo;

class ContractRequest extends Model {
    protected $fillable = [
        'client_id',
        'user_id',
        'contract_ids',
        'status',
        'link',
        'full_data',
    ];

    protected $casts = [
        'contract_ids' => 'array',
        'full_data' => 'array',
    ];

    use HasSlug;

    /**
     * Get the client that owns the contract request.
     */
    public function client(): BelongsTo {
        return $this->belongsTo(Client::class);
    }

    /**
     * Get the user who sent the request.
     */
    public function user(): BelongsTo {
        return $this->belongsTo(User::class);
    }
}