<?php

namespace App\Models;

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

class FileShare extends Model
{
    use HasFactory;

    protected $table = 'file_shares';

    protected $fillable = [
        'file_metadata_id',
        'user_id',
        'role_id',
        'view_only',
    ];

    public function file()
    {
        return $this->belongsTo(FileMetadata::class, 'file_metadata_id');
    }

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

    public function role()
    {
        return $this->belongsTo(Role::class);
    }
}
