<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
use App\Traits\GlobalModelEvents;

class Ownership extends Model
{
    use HasFactory, GlobalModelEvents;

    protected $fillable = [
        'slug', 'user_id', 'investment_id', 'product_id', 'value', 'quantity', 'type', 'wallet_source',
    ];

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

    public function product()
    {
        return $this->belongsTo(Product::class);
    }

    public function sells()
    {
        return $this->hasMany(Sell::class);
    }

    public function investment()
    {
        return $this->belongsTo(Investment::class);
    }
}
