/*
 * Certificate Manager Service API
 *
 * Using the Certificate Manager Service, you can conveniently provision and manage SSL certificates  with IONOS services and your internal connected resources.   For the [Application Load Balancer](https://api.ionos.com/docs/cloud/v6/#Application-Load-Balancers-get-datacenters-datacenterId-applicationloadbalancers), you usually need a certificate to encrypt your HTTPS traffic. The service provides the basic functions of uploading and deleting your certificates for this purpose.
 *
 * API version: 2.0
 */

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

package ionoscloud

import (
	"encoding/json"
)

// AutoCertificate Auto certificates create new certificates based on a certificate provider.
type AutoCertificate struct {
	// The certificate provider used to issue the certificates.
	Provider *string `json:"provider"`
	// The common name (DNS) of the certificate to issue. The common name needs to be part of a zone in IONOS Cloud DNS.
	CommonName *string `json:"commonName"`
	// The key algorithm used to generate the certificate.
	KeyAlgorithm *string `json:"keyAlgorithm"`
	// A certificate name used for management purposes.
	Name *string `json:"name,omitempty"`
	// Optional additional names to be added to the issued certificate. The additional names needs to be part of a zone in IONOS Cloud DNS.
	SubjectAlternativeNames *[]string `json:"subjectAlternativeNames,omitempty"`
}

// NewAutoCertificate instantiates a new AutoCertificate 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 NewAutoCertificate(provider string, commonName string, keyAlgorithm string) *AutoCertificate {
	this := AutoCertificate{}

	this.Provider = &provider
	this.CommonName = &commonName
	this.KeyAlgorithm = &keyAlgorithm

	return &this
}

// NewAutoCertificateWithDefaults instantiates a new AutoCertificate 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 NewAutoCertificateWithDefaults() *AutoCertificate {
	this := AutoCertificate{}
	return &this
}

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

	return o.Provider

}

// GetProviderOk returns a tuple with the Provider 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 *AutoCertificate) GetProviderOk() (*string, bool) {
	if o == nil {
		return nil, false
	}

	return o.Provider, true
}

// SetProvider sets field value
func (o *AutoCertificate) SetProvider(v string) {

	o.Provider = &v

}

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

	return false
}

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

	return o.CommonName

}

// GetCommonNameOk returns a tuple with the CommonName 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 *AutoCertificate) GetCommonNameOk() (*string, bool) {
	if o == nil {
		return nil, false
	}

	return o.CommonName, true
}

// SetCommonName sets field value
func (o *AutoCertificate) SetCommonName(v string) {

	o.CommonName = &v

}

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

	return false
}

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

	return o.KeyAlgorithm

}

// GetKeyAlgorithmOk returns a tuple with the KeyAlgorithm 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 *AutoCertificate) GetKeyAlgorithmOk() (*string, bool) {
	if o == nil {
		return nil, false
	}

	return o.KeyAlgorithm, true
}

// SetKeyAlgorithm sets field value
func (o *AutoCertificate) SetKeyAlgorithm(v string) {

	o.KeyAlgorithm = &v

}

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

	return false
}

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

	return o.Name

}

// GetNameOk returns a tuple with the Name 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 *AutoCertificate) GetNameOk() (*string, bool) {
	if o == nil {
		return nil, false
	}

	return o.Name, true
}

// SetName sets field value
func (o *AutoCertificate) SetName(v string) {

	o.Name = &v

}

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

	return false
}

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

	return o.SubjectAlternativeNames

}

// GetSubjectAlternativeNamesOk returns a tuple with the SubjectAlternativeNames 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 *AutoCertificate) GetSubjectAlternativeNamesOk() (*[]string, bool) {
	if o == nil {
		return nil, false
	}

	return o.SubjectAlternativeNames, true
}

// SetSubjectAlternativeNames sets field value
func (o *AutoCertificate) SetSubjectAlternativeNames(v []string) {

	o.SubjectAlternativeNames = &v

}

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

	return false
}

func (o AutoCertificate) MarshalJSON() ([]byte, error) {
	toSerialize := map[string]interface{}{}
	if o.Provider != nil {
		toSerialize["provider"] = o.Provider
	}

	if o.CommonName != nil {
		toSerialize["commonName"] = o.CommonName
	}

	if o.KeyAlgorithm != nil {
		toSerialize["keyAlgorithm"] = o.KeyAlgorithm
	}

	if o.Name != nil {
		toSerialize["name"] = o.Name
	}

	if o.SubjectAlternativeNames != nil {
		toSerialize["subjectAlternativeNames"] = o.SubjectAlternativeNames
	}

	return json.Marshal(toSerialize)
}

type NullableAutoCertificate struct {
	value *AutoCertificate
	isSet bool
}

func (v NullableAutoCertificate) Get() *AutoCertificate {
	return v.value
}

func (v *NullableAutoCertificate) Set(val *AutoCertificate) {
	v.value = val
	v.isSet = true
}

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

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

func NewNullableAutoCertificate(val *AutoCertificate) *NullableAutoCertificate {
	return &NullableAutoCertificate{value: val, isSet: true}
}

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

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