// Code generated by go-swagger; DO NOT EDIT.

package models

// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command

import (
	"context"

	"github.com/go-openapi/errors"
	"github.com/go-openapi/strfmt"
	"github.com/go-openapi/swag"
	"github.com/go-openapi/validate"
)

// HashicorpCloudPacker20230101Vulnerability hashicorp cloud packer 20230101 vulnerability
//
// swagger:model hashicorp.cloud.packer_20230101.Vulnerability
type HashicorpCloudPacker20230101Vulnerability struct {

	// Criticality derived from score (e.g. Critical, High, Medium, Low, Unknown).
	Criticality string `json:"criticality,omitempty"`

	// Human-readable description of the vulnerability.
	Description string `json:"description,omitempty"`

	// Timestamp when this vulnerability was first detected for this package.
	// Format: date-time
	FirstSeenAt strfmt.DateTime `json:"first_seen_at,omitempty"`

	// Version of the package that fixes this vulnerability, if available.
	FixedVersion string `json:"fixed_version,omitempty"`

	// Unique identifier for the vulnerability (e.g., CVE ID, GHSA ID).
	Identifier string `json:"identifier,omitempty"`

	// Timestamp when this vulnerability was originally published.
	// Format: date-time
	PublishedAt strfmt.DateTime `json:"published_at,omitempty"`

	// Comma-separated list of vulnerability identifiers this vulnerability refers to.
	RefersTo string `json:"refers_to,omitempty"`

	// Comma-separated list of related vulnerability identifiers.
	Related string `json:"related,omitempty"`

	// Timestamp when this vulnerability was resolved, if applicable.
	// Format: date-time
	ResolvedAt strfmt.DateTime `json:"resolved_at,omitempty"`

	// Severity level of the vulnerability (e.g., "CRITICAL", "HIGH", "MEDIUM", "LOW").
	Severity string `json:"severity,omitempty"`

	// Timestamp when this vulnerability was withdrawn, if applicable.
	// Format: date-time
	WithdrawnAt strfmt.DateTime `json:"withdrawn_at,omitempty"`
}

// Validate validates this hashicorp cloud packer 20230101 vulnerability
func (m *HashicorpCloudPacker20230101Vulnerability) Validate(formats strfmt.Registry) error {
	var res []error

	if err := m.validateFirstSeenAt(formats); err != nil {
		res = append(res, err)
	}

	if err := m.validatePublishedAt(formats); err != nil {
		res = append(res, err)
	}

	if err := m.validateResolvedAt(formats); err != nil {
		res = append(res, err)
	}

	if err := m.validateWithdrawnAt(formats); err != nil {
		res = append(res, err)
	}

	if len(res) > 0 {
		return errors.CompositeValidationError(res...)
	}
	return nil
}

func (m *HashicorpCloudPacker20230101Vulnerability) validateFirstSeenAt(formats strfmt.Registry) error {
	if swag.IsZero(m.FirstSeenAt) { // not required
		return nil
	}

	if err := validate.FormatOf("first_seen_at", "body", "date-time", m.FirstSeenAt.String(), formats); err != nil {
		return err
	}

	return nil
}

func (m *HashicorpCloudPacker20230101Vulnerability) validatePublishedAt(formats strfmt.Registry) error {
	if swag.IsZero(m.PublishedAt) { // not required
		return nil
	}

	if err := validate.FormatOf("published_at", "body", "date-time", m.PublishedAt.String(), formats); err != nil {
		return err
	}

	return nil
}

func (m *HashicorpCloudPacker20230101Vulnerability) validateResolvedAt(formats strfmt.Registry) error {
	if swag.IsZero(m.ResolvedAt) { // not required
		return nil
	}

	if err := validate.FormatOf("resolved_at", "body", "date-time", m.ResolvedAt.String(), formats); err != nil {
		return err
	}

	return nil
}

func (m *HashicorpCloudPacker20230101Vulnerability) validateWithdrawnAt(formats strfmt.Registry) error {
	if swag.IsZero(m.WithdrawnAt) { // not required
		return nil
	}

	if err := validate.FormatOf("withdrawn_at", "body", "date-time", m.WithdrawnAt.String(), formats); err != nil {
		return err
	}

	return nil
}

// ContextValidate validates this hashicorp cloud packer 20230101 vulnerability based on context it is used
func (m *HashicorpCloudPacker20230101Vulnerability) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
	return nil
}

// MarshalBinary interface implementation
func (m *HashicorpCloudPacker20230101Vulnerability) MarshalBinary() ([]byte, error) {
	if m == nil {
		return nil, nil
	}
	return swag.WriteJSON(m)
}

// UnmarshalBinary interface implementation
func (m *HashicorpCloudPacker20230101Vulnerability) UnmarshalBinary(b []byte) error {
	var res HashicorpCloudPacker20230101Vulnerability
	if err := swag.ReadJSON(b, &res); err != nil {
		return err
	}
	*m = res
	return nil
}
