<?php

namespace App\Policies;

use App\Models\Contact;
use App\Models\User;

class ContactPolicy
{
    public function viewAny(User $user): bool
    {
        return $user->current_team_id !== null;
    }

    public function view(User $user, Contact $contact): bool
    {
        return $contact->team_id === $user->current_team_id;
    }

    public function create(User $user): bool
    {
        return $user->current_team_id !== null;
    }

    public function update(User $user, Contact $contact): bool
    {
        return $contact->team_id === $user->current_team_id;
    }

    public function delete(User $user, Contact $contact): bool
    {
        return $contact->team_id === $user->current_team_id;
    }

    public function restore(User $user, Contact $contact): bool
    {
        return $contact->team_id === $user->current_team_id;
    }

    public function forceDelete(User $user, Contact $contact): bool
    {
        return $contact->team_id === $user->current_team_id;
    }
}
