# frozen_string_literal: true

# Placeholder class for model that is implemented in EE
class Vulnerability < ::SecApplicationRecord
  include EachBatch
  include AfterCommitQueue
  include IgnorableColumns

  UNVERIFIED_NAME_PREFIX = '(Unverified)'

  alias_attribute :vulnerability_id, :id

  scope :with_projects, -> { preload(:project) }

  # Limit is a safety precaution. Ideally a inner query limit should be applied
  scope :pluck_distinct_project_ids, -> { limit(10_000).pluck('DISTINCT project_id') }

  validates :cvss, json_schema: { filename: "vulnerability_cvss_vectors" }
  attribute :cvss, ::Gitlab::Database::Type::IndifferentJsonb.new

  def self.link_reference_pattern
    nil
  end

  def self.reference_prefix
    '[vulnerability:'
  end

  def self.reference_postfix
    ']'
  end
end

Vulnerability.prepend_mod
