<?php
namespace App\Policies;
use App\Enums\{KeywordStatus,ProjectStatus,RoleName};use App\Models\{Keyword,SerpCheck,User};
class SerpCheckPolicy{
 public function viewAny(User $u):bool{return $u->hasRole(RoleName::Customer)||$u->hasPermission('serp_checks.view');}
 public function view(User $u,SerpCheck $c):bool{return $c->keyword->project->user_id===$u->id||$u->hasPermission('serp_checks.view');}
 public function create(User $u,Keyword $k):bool{return $k->project->user_id===$u->id&&$u->hasRole(RoleName::Customer)&&$k->status===KeywordStatus::Active&&$k->archived_at===null&&$k->project->status===ProjectStatus::Active&&$k->project->archived_at===null;}
 public function update(User $u,SerpCheck $c):bool{return false;}
 public function delete(User $u,SerpCheck $c):bool{return false;}
 public function deleteAny(User $u):bool{return false;}
}
