# Copyright 2019 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

# NOTE: This file is auto generated by the elixir code generator program.
# Do not edit this file manually.

defmodule GoogleApi.SecurityCenter.V1.Model.Vulnerability do
  @moduledoc """
  Refers to common vulnerability fields e.g. cve, cvss, cwe etc.

  ## Attributes

  *   `cve` (*type:* `GoogleApi.SecurityCenter.V1.Model.Cve.t`, *default:* `nil`) - CVE stands for Common Vulnerabilities and Exposures (https://cve.mitre.org/about/)
  *   `cwes` (*type:* `list(GoogleApi.SecurityCenter.V1.Model.Cwe.t)`, *default:* `nil`) - Represents one or more Common Weakness Enumeration (CWE) information on this vulnerability.
  *   `fixedPackage` (*type:* `GoogleApi.SecurityCenter.V1.Model.Package.t`, *default:* `nil`) - The fixed package is relevant to the finding.
  *   `offendingPackage` (*type:* `GoogleApi.SecurityCenter.V1.Model.Package.t`, *default:* `nil`) - The offending package is relevant to the finding.
  *   `providerRiskScore` (*type:* `String.t`, *default:* `nil`) - Provider provided risk_score based on multiple factors. The higher the risk score, the more risky the vulnerability is.
  *   `reachable` (*type:* `boolean()`, *default:* `nil`) - Represents whether the vulnerability is reachable (detected via static analysis)
  *   `securityBulletin` (*type:* `GoogleApi.SecurityCenter.V1.Model.SecurityBulletin.t`, *default:* `nil`) - The security bulletin is relevant to this finding.
  """

  use GoogleApi.Gax.ModelBase

  @type t :: %__MODULE__{
          :cve => GoogleApi.SecurityCenter.V1.Model.Cve.t() | nil,
          :cwes => list(GoogleApi.SecurityCenter.V1.Model.Cwe.t()) | nil,
          :fixedPackage => GoogleApi.SecurityCenter.V1.Model.Package.t() | nil,
          :offendingPackage => GoogleApi.SecurityCenter.V1.Model.Package.t() | nil,
          :providerRiskScore => String.t() | nil,
          :reachable => boolean() | nil,
          :securityBulletin => GoogleApi.SecurityCenter.V1.Model.SecurityBulletin.t() | nil
        }

  field(:cve, as: GoogleApi.SecurityCenter.V1.Model.Cve)
  field(:cwes, as: GoogleApi.SecurityCenter.V1.Model.Cwe, type: :list)
  field(:fixedPackage, as: GoogleApi.SecurityCenter.V1.Model.Package)
  field(:offendingPackage, as: GoogleApi.SecurityCenter.V1.Model.Package)
  field(:providerRiskScore)
  field(:reachable)
  field(:securityBulletin, as: GoogleApi.SecurityCenter.V1.Model.SecurityBulletin)
end

defimpl Poison.Decoder, for: GoogleApi.SecurityCenter.V1.Model.Vulnerability do
  def decode(value, options) do
    GoogleApi.SecurityCenter.V1.Model.Vulnerability.decode(value, options)
  end
end

defimpl Poison.Encoder, for: GoogleApi.SecurityCenter.V1.Model.Vulnerability do
  def encode(value, options) do
    GoogleApi.Gax.ModelBase.encode(value, options)
  end
end
