<?php

namespace App\Policies\Contact;

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

class ContactTemplatePolicy
{
    public function viewAny(User $user): bool
    {
        return $user->can('communications.templates.manage')
            || $user->can('templates.view');
    }

    public function view(User $user, ContactTemplate $template): bool
    {
        return $this->viewAny($user);
    }

    public function manage(User $user): bool
    {
        return $user->can('communications.templates.manage');
    }

    public function create(User $user): bool
    {
        return $this->manage($user);
    }

    public function update(User $user, ContactTemplate $template): bool
    {
        return $this->manage($user);
    }

    public function delete(User $user, ContactTemplate $template): bool
    {
        return $this->manage($user);
    }
}
