<?php

namespace App\Models;

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

class Jasa extends Model
{
    protected $table = 'jasa';

    protected $fillable = [
        'user_id',
        'address_id',
        'merek_printer',
        'tipe_printer',
        'kategori_keluhan',
        'deskripsi_masalah',
        'foto_video_kondisi',
        'pernah_diservis',
        'jenis_layanan',
        'status',
        'rating',
        'testimoni',
    ];

    /**
     * Relasi ke User (Pemilik Service)
     */
    public function user(): BelongsTo
    {
        return $this->belongsTo(User::class);
    }

    /**
     * Relasi ke Alamat (IndoRegion Address)
     */
    public function address(): BelongsTo
    {
        return $this->belongsTo(Address::class);
    }

    public function reviews()
    {
        return $this->hasMany(Review::class);
    }
}