<?php

namespace App\Models;

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

/**
 * @package App\Models
 * @property int $id
 * @property int $partner_id
 * @property int $city_id
 * @property int $user_id
 * @property $price
 * @property string|null $comment
 * @property int $phone
 * @property string $status // pending, accepted, closed, rejected
 * @property string $full_name
 *
 * @property Partner $partner
 * @property City $city
 * @property Status $getStatus
 */
class PartnerRequest extends Model
{
    use HasFactory;

    protected $fillable = [
        'partner_id',
        'city_id',
        'user_id',
        'price',
        'comment',
        'phone',
        'full_name',
        'status'
    ];

    public function getStatus(): BelongsTo
    {
        return $this->belongsTo(Status::class, 'status', 'slug');
    }

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

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

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