class VideoPolicy < ApplicationPolicy
  def create?
    true
  end

  def show?
    true
  end

  def update?
    true
  end

  class Scope < Scope
    def resolve
      return scope.all if user.admin?
      if user.account_manager?
        scope.joins(project: { account: :account_auths }).where(account_auths: { user_id: user.id })
      else
        scope.joins(project: :project_memberships).where(projects: { project_memberships: { user: user.id }})
      end
    end
  end
end
