/*
 * Container Registry service
 *
 * ## Overview Container Registry service enables IONOS clients to manage docker and OCI compliant registries for use by their managed Kubernetes clusters. Use a Container Registry to ensure you have a privately accessed registry to efficiently support image pulls. ## Changelog ### 1.1.0  - Added new endpoints for Repositories  - Added new endpoints for Artifacts  - Added new endpoints for Vulnerabilities  - Added registry vulnerabilityScanning feature ### 1.2.0 - Added registry `apiSubnetAllowList`
 *
 * API version: 1.2.0
 * Contact: support@cloud.ionos.com
 */

// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT.

package ionoscloud

import (
	"encoding/json"
)

// Vulnerability struct for Vulnerability
type Vulnerability struct {
	// A description of the vulnerability as provided by the source.
	Description *string `json:"description"`
	// Recommendations for the vulnerability as provided by the source.
	Recommendations *string                  `json:"recommendations,omitempty"`
	DataSource      *VulnerabilityDataSource `json:"dataSource"`
	// Indicates whether the vulnerability can be fixed by updating the affected package.
	Fixable *bool   `json:"fixable"`
	Affects *[]Purl `json:"affects"`
	// Published advisories of the vulnerability if provided.
	References *[]string `json:"references,omitempty"`
	// The CVSS vulnerability severity rating
	Severity *string `json:"severity"`
	// The CVSS score of the vulnerability
	Score *float32 `json:"score"`
}

// NewVulnerability instantiates a new Vulnerability object
// This constructor will assign default values to properties that have it defined,
// and makes sure properties required by API are set, but the set of arguments
// will change when the set of required properties is changed
func NewVulnerability(description string, dataSource VulnerabilityDataSource, fixable bool, affects []Purl, severity string, score float32) *Vulnerability {
	this := Vulnerability{}

	this.Description = &description
	this.DataSource = &dataSource
	this.Fixable = &fixable
	this.Affects = &affects
	this.Severity = &severity
	this.Score = &score

	return &this
}

// NewVulnerabilityWithDefaults instantiates a new Vulnerability object
// This constructor will only assign default values to properties that have it defined,
// but it doesn't guarantee that properties required by API are set
func NewVulnerabilityWithDefaults() *Vulnerability {
	this := Vulnerability{}
	return &this
}

// GetDescription returns the Description field value
// If the value is explicit nil, the zero value for string will be returned
func (o *Vulnerability) GetDescription() *string {
	if o == nil {
		return nil
	}

	return o.Description

}

// GetDescriptionOk returns a tuple with the Description field value
// and a boolean to check if the value has been set.
// NOTE: If the value is an explicit nil, `nil, true` will be returned
func (o *Vulnerability) GetDescriptionOk() (*string, bool) {
	if o == nil {
		return nil, false
	}

	return o.Description, true
}

// SetDescription sets field value
func (o *Vulnerability) SetDescription(v string) {

	o.Description = &v

}

// HasDescription returns a boolean if a field has been set.
func (o *Vulnerability) HasDescription() bool {
	if o != nil && o.Description != nil {
		return true
	}

	return false
}

// GetRecommendations returns the Recommendations field value
// If the value is explicit nil, the zero value for string will be returned
func (o *Vulnerability) GetRecommendations() *string {
	if o == nil {
		return nil
	}

	return o.Recommendations

}

// GetRecommendationsOk returns a tuple with the Recommendations field value
// and a boolean to check if the value has been set.
// NOTE: If the value is an explicit nil, `nil, true` will be returned
func (o *Vulnerability) GetRecommendationsOk() (*string, bool) {
	if o == nil {
		return nil, false
	}

	return o.Recommendations, true
}

// SetRecommendations sets field value
func (o *Vulnerability) SetRecommendations(v string) {

	o.Recommendations = &v

}

// HasRecommendations returns a boolean if a field has been set.
func (o *Vulnerability) HasRecommendations() bool {
	if o != nil && o.Recommendations != nil {
		return true
	}

	return false
}

// GetDataSource returns the DataSource field value
// If the value is explicit nil, the zero value for VulnerabilityDataSource will be returned
func (o *Vulnerability) GetDataSource() *VulnerabilityDataSource {
	if o == nil {
		return nil
	}

	return o.DataSource

}

// GetDataSourceOk returns a tuple with the DataSource field value
// and a boolean to check if the value has been set.
// NOTE: If the value is an explicit nil, `nil, true` will be returned
func (o *Vulnerability) GetDataSourceOk() (*VulnerabilityDataSource, bool) {
	if o == nil {
		return nil, false
	}

	return o.DataSource, true
}

// SetDataSource sets field value
func (o *Vulnerability) SetDataSource(v VulnerabilityDataSource) {

	o.DataSource = &v

}

// HasDataSource returns a boolean if a field has been set.
func (o *Vulnerability) HasDataSource() bool {
	if o != nil && o.DataSource != nil {
		return true
	}

	return false
}

// GetFixable returns the Fixable field value
// If the value is explicit nil, the zero value for bool will be returned
func (o *Vulnerability) GetFixable() *bool {
	if o == nil {
		return nil
	}

	return o.Fixable

}

// GetFixableOk returns a tuple with the Fixable field value
// and a boolean to check if the value has been set.
// NOTE: If the value is an explicit nil, `nil, true` will be returned
func (o *Vulnerability) GetFixableOk() (*bool, bool) {
	if o == nil {
		return nil, false
	}

	return o.Fixable, true
}

// SetFixable sets field value
func (o *Vulnerability) SetFixable(v bool) {

	o.Fixable = &v

}

// HasFixable returns a boolean if a field has been set.
func (o *Vulnerability) HasFixable() bool {
	if o != nil && o.Fixable != nil {
		return true
	}

	return false
}

// GetAffects returns the Affects field value
// If the value is explicit nil, the zero value for []Purl will be returned
func (o *Vulnerability) GetAffects() *[]Purl {
	if o == nil {
		return nil
	}

	return o.Affects

}

// GetAffectsOk returns a tuple with the Affects field value
// and a boolean to check if the value has been set.
// NOTE: If the value is an explicit nil, `nil, true` will be returned
func (o *Vulnerability) GetAffectsOk() (*[]Purl, bool) {
	if o == nil {
		return nil, false
	}

	return o.Affects, true
}

// SetAffects sets field value
func (o *Vulnerability) SetAffects(v []Purl) {

	o.Affects = &v

}

// HasAffects returns a boolean if a field has been set.
func (o *Vulnerability) HasAffects() bool {
	if o != nil && o.Affects != nil {
		return true
	}

	return false
}

// GetReferences returns the References field value
// If the value is explicit nil, the zero value for []string will be returned
func (o *Vulnerability) GetReferences() *[]string {
	if o == nil {
		return nil
	}

	return o.References

}

// GetReferencesOk returns a tuple with the References field value
// and a boolean to check if the value has been set.
// NOTE: If the value is an explicit nil, `nil, true` will be returned
func (o *Vulnerability) GetReferencesOk() (*[]string, bool) {
	if o == nil {
		return nil, false
	}

	return o.References, true
}

// SetReferences sets field value
func (o *Vulnerability) SetReferences(v []string) {

	o.References = &v

}

// HasReferences returns a boolean if a field has been set.
func (o *Vulnerability) HasReferences() bool {
	if o != nil && o.References != nil {
		return true
	}

	return false
}

// GetSeverity returns the Severity field value
// If the value is explicit nil, the zero value for string will be returned
func (o *Vulnerability) GetSeverity() *string {
	if o == nil {
		return nil
	}

	return o.Severity

}

// GetSeverityOk returns a tuple with the Severity field value
// and a boolean to check if the value has been set.
// NOTE: If the value is an explicit nil, `nil, true` will be returned
func (o *Vulnerability) GetSeverityOk() (*string, bool) {
	if o == nil {
		return nil, false
	}

	return o.Severity, true
}

// SetSeverity sets field value
func (o *Vulnerability) SetSeverity(v string) {

	o.Severity = &v

}

// HasSeverity returns a boolean if a field has been set.
func (o *Vulnerability) HasSeverity() bool {
	if o != nil && o.Severity != nil {
		return true
	}

	return false
}

// GetScore returns the Score field value
// If the value is explicit nil, the zero value for float32 will be returned
func (o *Vulnerability) GetScore() *float32 {
	if o == nil {
		return nil
	}

	return o.Score

}

// GetScoreOk returns a tuple with the Score field value
// and a boolean to check if the value has been set.
// NOTE: If the value is an explicit nil, `nil, true` will be returned
func (o *Vulnerability) GetScoreOk() (*float32, bool) {
	if o == nil {
		return nil, false
	}

	return o.Score, true
}

// SetScore sets field value
func (o *Vulnerability) SetScore(v float32) {

	o.Score = &v

}

// HasScore returns a boolean if a field has been set.
func (o *Vulnerability) HasScore() bool {
	if o != nil && o.Score != nil {
		return true
	}

	return false
}

func (o Vulnerability) MarshalJSON() ([]byte, error) {
	toSerialize := map[string]interface{}{}
	if o.Description != nil {
		toSerialize["description"] = o.Description
	}

	if o.Recommendations != nil {
		toSerialize["recommendations"] = o.Recommendations
	}

	if o.DataSource != nil {
		toSerialize["dataSource"] = o.DataSource
	}

	if o.Fixable != nil {
		toSerialize["fixable"] = o.Fixable
	}

	if o.Affects != nil {
		toSerialize["affects"] = o.Affects
	}

	if o.References != nil {
		toSerialize["references"] = o.References
	}

	if o.Severity != nil {
		toSerialize["severity"] = o.Severity
	}

	if o.Score != nil {
		toSerialize["score"] = o.Score
	}

	return json.Marshal(toSerialize)
}

type NullableVulnerability struct {
	value *Vulnerability
	isSet bool
}

func (v NullableVulnerability) Get() *Vulnerability {
	return v.value
}

func (v *NullableVulnerability) Set(val *Vulnerability) {
	v.value = val
	v.isSet = true
}

func (v NullableVulnerability) IsSet() bool {
	return v.isSet
}

func (v *NullableVulnerability) Unset() {
	v.value = nil
	v.isSet = false
}

func NewNullableVulnerability(val *Vulnerability) *NullableVulnerability {
	return &NullableVulnerability{value: val, isSet: true}
}

func (v NullableVulnerability) MarshalJSON() ([]byte, error) {
	return json.Marshal(v.value)
}

func (v *NullableVulnerability) UnmarshalJSON(src []byte) error {
	v.isSet = true
	return json.Unmarshal(src, &v.value)
}
