/*
Merlin

API Guide for accessing Merlin's model management, deployment, and serving functionalities

API version: 0.14.0
*/

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

package client

import (
	"encoding/json"
)

// checks if the ResourceRequest type satisfies the MappedNullable interface at compile time
var _ MappedNullable = &ResourceRequest{}

// ResourceRequest struct for ResourceRequest
type ResourceRequest struct {
	MinReplica    *int32  `json:"min_replica,omitempty"`
	MaxReplica    *int32  `json:"max_replica,omitempty"`
	CpuRequest    *string `json:"cpu_request,omitempty"`
	CpuLimit      *string `json:"cpu_limit,omitempty"`
	MemoryRequest *string `json:"memory_request,omitempty"`
	GpuName       *string `json:"gpu_name,omitempty"`
	GpuRequest    *string `json:"gpu_request,omitempty"`
}

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

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

// GetMinReplica returns the MinReplica field value if set, zero value otherwise.
func (o *ResourceRequest) GetMinReplica() int32 {
	if o == nil || IsNil(o.MinReplica) {
		var ret int32
		return ret
	}
	return *o.MinReplica
}

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

// HasMinReplica returns a boolean if a field has been set.
func (o *ResourceRequest) HasMinReplica() bool {
	if o != nil && !IsNil(o.MinReplica) {
		return true
	}

	return false
}

// SetMinReplica gets a reference to the given int32 and assigns it to the MinReplica field.
func (o *ResourceRequest) SetMinReplica(v int32) {
	o.MinReplica = &v
}

// GetMaxReplica returns the MaxReplica field value if set, zero value otherwise.
func (o *ResourceRequest) GetMaxReplica() int32 {
	if o == nil || IsNil(o.MaxReplica) {
		var ret int32
		return ret
	}
	return *o.MaxReplica
}

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

// HasMaxReplica returns a boolean if a field has been set.
func (o *ResourceRequest) HasMaxReplica() bool {
	if o != nil && !IsNil(o.MaxReplica) {
		return true
	}

	return false
}

// SetMaxReplica gets a reference to the given int32 and assigns it to the MaxReplica field.
func (o *ResourceRequest) SetMaxReplica(v int32) {
	o.MaxReplica = &v
}

// GetCpuRequest returns the CpuRequest field value if set, zero value otherwise.
func (o *ResourceRequest) GetCpuRequest() string {
	if o == nil || IsNil(o.CpuRequest) {
		var ret string
		return ret
	}
	return *o.CpuRequest
}

// GetCpuRequestOk returns a tuple with the CpuRequest field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *ResourceRequest) GetCpuRequestOk() (*string, bool) {
	if o == nil || IsNil(o.CpuRequest) {
		return nil, false
	}
	return o.CpuRequest, true
}

// HasCpuRequest returns a boolean if a field has been set.
func (o *ResourceRequest) HasCpuRequest() bool {
	if o != nil && !IsNil(o.CpuRequest) {
		return true
	}

	return false
}

// SetCpuRequest gets a reference to the given string and assigns it to the CpuRequest field.
func (o *ResourceRequest) SetCpuRequest(v string) {
	o.CpuRequest = &v
}

// GetCpuLimit returns the CpuLimit field value if set, zero value otherwise.
func (o *ResourceRequest) GetCpuLimit() string {
	if o == nil || IsNil(o.CpuLimit) {
		var ret string
		return ret
	}
	return *o.CpuLimit
}

// GetCpuLimitOk returns a tuple with the CpuLimit field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *ResourceRequest) GetCpuLimitOk() (*string, bool) {
	if o == nil || IsNil(o.CpuLimit) {
		return nil, false
	}
	return o.CpuLimit, true
}

// HasCpuLimit returns a boolean if a field has been set.
func (o *ResourceRequest) HasCpuLimit() bool {
	if o != nil && !IsNil(o.CpuLimit) {
		return true
	}

	return false
}

// SetCpuLimit gets a reference to the given string and assigns it to the CpuLimit field.
func (o *ResourceRequest) SetCpuLimit(v string) {
	o.CpuLimit = &v
}

// GetMemoryRequest returns the MemoryRequest field value if set, zero value otherwise.
func (o *ResourceRequest) GetMemoryRequest() string {
	if o == nil || IsNil(o.MemoryRequest) {
		var ret string
		return ret
	}
	return *o.MemoryRequest
}

// GetMemoryRequestOk returns a tuple with the MemoryRequest field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *ResourceRequest) GetMemoryRequestOk() (*string, bool) {
	if o == nil || IsNil(o.MemoryRequest) {
		return nil, false
	}
	return o.MemoryRequest, true
}

// HasMemoryRequest returns a boolean if a field has been set.
func (o *ResourceRequest) HasMemoryRequest() bool {
	if o != nil && !IsNil(o.MemoryRequest) {
		return true
	}

	return false
}

// SetMemoryRequest gets a reference to the given string and assigns it to the MemoryRequest field.
func (o *ResourceRequest) SetMemoryRequest(v string) {
	o.MemoryRequest = &v
}

// GetGpuName returns the GpuName field value if set, zero value otherwise.
func (o *ResourceRequest) GetGpuName() string {
	if o == nil || IsNil(o.GpuName) {
		var ret string
		return ret
	}
	return *o.GpuName
}

// GetGpuNameOk returns a tuple with the GpuName field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *ResourceRequest) GetGpuNameOk() (*string, bool) {
	if o == nil || IsNil(o.GpuName) {
		return nil, false
	}
	return o.GpuName, true
}

// HasGpuName returns a boolean if a field has been set.
func (o *ResourceRequest) HasGpuName() bool {
	if o != nil && !IsNil(o.GpuName) {
		return true
	}

	return false
}

// SetGpuName gets a reference to the given string and assigns it to the GpuName field.
func (o *ResourceRequest) SetGpuName(v string) {
	o.GpuName = &v
}

// GetGpuRequest returns the GpuRequest field value if set, zero value otherwise.
func (o *ResourceRequest) GetGpuRequest() string {
	if o == nil || IsNil(o.GpuRequest) {
		var ret string
		return ret
	}
	return *o.GpuRequest
}

// GetGpuRequestOk returns a tuple with the GpuRequest field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *ResourceRequest) GetGpuRequestOk() (*string, bool) {
	if o == nil || IsNil(o.GpuRequest) {
		return nil, false
	}
	return o.GpuRequest, true
}

// HasGpuRequest returns a boolean if a field has been set.
func (o *ResourceRequest) HasGpuRequest() bool {
	if o != nil && !IsNil(o.GpuRequest) {
		return true
	}

	return false
}

// SetGpuRequest gets a reference to the given string and assigns it to the GpuRequest field.
func (o *ResourceRequest) SetGpuRequest(v string) {
	o.GpuRequest = &v
}

func (o ResourceRequest) MarshalJSON() ([]byte, error) {
	toSerialize, err := o.ToMap()
	if err != nil {
		return []byte{}, err
	}
	return json.Marshal(toSerialize)
}

func (o ResourceRequest) ToMap() (map[string]interface{}, error) {
	toSerialize := map[string]interface{}{}
	if !IsNil(o.MinReplica) {
		toSerialize["min_replica"] = o.MinReplica
	}
	if !IsNil(o.MaxReplica) {
		toSerialize["max_replica"] = o.MaxReplica
	}
	if !IsNil(o.CpuRequest) {
		toSerialize["cpu_request"] = o.CpuRequest
	}
	if !IsNil(o.CpuLimit) {
		toSerialize["cpu_limit"] = o.CpuLimit
	}
	if !IsNil(o.MemoryRequest) {
		toSerialize["memory_request"] = o.MemoryRequest
	}
	if !IsNil(o.GpuName) {
		toSerialize["gpu_name"] = o.GpuName
	}
	if !IsNil(o.GpuRequest) {
		toSerialize["gpu_request"] = o.GpuRequest
	}
	return toSerialize, nil
}

type NullableResourceRequest struct {
	value *ResourceRequest
	isSet bool
}

func (v NullableResourceRequest) Get() *ResourceRequest {
	return v.value
}

func (v *NullableResourceRequest) Set(val *ResourceRequest) {
	v.value = val
	v.isSet = true
}

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

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

func NewNullableResourceRequest(val *ResourceRequest) *NullableResourceRequest {
	return &NullableResourceRequest{value: val, isSet: true}
}

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

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