/*
Cloud Hypervisor API

Local HTTP based API for managing and inspecting a cloud-hypervisor virtual machine.

API version: 0.3.0
*/

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

package openapi

import (
	"encoding/json"
)

// PciSegmentConfig struct for PciSegmentConfig
type PciSegmentConfig struct {
	PciSegment           int32  `json:"pci_segment"`
	Mmio32ApertureWeight *int32 `json:"mmio32_aperture_weight,omitempty"`
	Mmio64ApertureWeight *int32 `json:"mmio64_aperture_weight,omitempty"`
}

// NewPciSegmentConfig instantiates a new PciSegmentConfig 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 NewPciSegmentConfig(pciSegment int32) *PciSegmentConfig {
	this := PciSegmentConfig{}
	this.PciSegment = pciSegment
	return &this
}

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

// GetPciSegment returns the PciSegment field value
func (o *PciSegmentConfig) GetPciSegment() int32 {
	if o == nil {
		var ret int32
		return ret
	}

	return o.PciSegment
}

// GetPciSegmentOk returns a tuple with the PciSegment field value
// and a boolean to check if the value has been set.
func (o *PciSegmentConfig) GetPciSegmentOk() (*int32, bool) {
	if o == nil {
		return nil, false
	}
	return &o.PciSegment, true
}

// SetPciSegment sets field value
func (o *PciSegmentConfig) SetPciSegment(v int32) {
	o.PciSegment = v
}

// GetMmio32ApertureWeight returns the Mmio32ApertureWeight field value if set, zero value otherwise.
func (o *PciSegmentConfig) GetMmio32ApertureWeight() int32 {
	if o == nil || o.Mmio32ApertureWeight == nil {
		var ret int32
		return ret
	}
	return *o.Mmio32ApertureWeight
}

// GetMmio32ApertureWeightOk returns a tuple with the Mmio32ApertureWeight field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *PciSegmentConfig) GetMmio32ApertureWeightOk() (*int32, bool) {
	if o == nil || o.Mmio32ApertureWeight == nil {
		return nil, false
	}
	return o.Mmio32ApertureWeight, true
}

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

	return false
}

// SetMmio32ApertureWeight gets a reference to the given int32 and assigns it to the Mmio32ApertureWeight field.
func (o *PciSegmentConfig) SetMmio32ApertureWeight(v int32) {
	o.Mmio32ApertureWeight = &v
}

// GetMmio64ApertureWeight returns the Mmio64ApertureWeight field value if set, zero value otherwise.
func (o *PciSegmentConfig) GetMmio64ApertureWeight() int32 {
	if o == nil || o.Mmio64ApertureWeight == nil {
		var ret int32
		return ret
	}
	return *o.Mmio64ApertureWeight
}

// GetMmio64ApertureWeightOk returns a tuple with the Mmio64ApertureWeight field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *PciSegmentConfig) GetMmio64ApertureWeightOk() (*int32, bool) {
	if o == nil || o.Mmio64ApertureWeight == nil {
		return nil, false
	}
	return o.Mmio64ApertureWeight, true
}

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

	return false
}

// SetMmio64ApertureWeight gets a reference to the given int32 and assigns it to the Mmio64ApertureWeight field.
func (o *PciSegmentConfig) SetMmio64ApertureWeight(v int32) {
	o.Mmio64ApertureWeight = &v
}

func (o PciSegmentConfig) MarshalJSON() ([]byte, error) {
	toSerialize := map[string]interface{}{}
	if true {
		toSerialize["pci_segment"] = o.PciSegment
	}
	if o.Mmio32ApertureWeight != nil {
		toSerialize["mmio32_aperture_weight"] = o.Mmio32ApertureWeight
	}
	if o.Mmio64ApertureWeight != nil {
		toSerialize["mmio64_aperture_weight"] = o.Mmio64ApertureWeight
	}
	return json.Marshal(toSerialize)
}

type NullablePciSegmentConfig struct {
	value *PciSegmentConfig
	isSet bool
}

func (v NullablePciSegmentConfig) Get() *PciSegmentConfig {
	return v.value
}

func (v *NullablePciSegmentConfig) Set(val *PciSegmentConfig) {
	v.value = val
	v.isSet = true
}

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

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

func NewNullablePciSegmentConfig(val *PciSegmentConfig) *NullablePciSegmentConfig {
	return &NullablePciSegmentConfig{value: val, isSet: true}
}

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

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