/*
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 VersionImage type satisfies the MappedNullable interface at compile time
var _ MappedNullable = &VersionImage{}

// VersionImage struct for VersionImage
type VersionImage struct {
	ProjectId              *int32                  `json:"project_id,omitempty"`
	ModelId                *int32                  `json:"model_id,omitempty"`
	VersionId              *int32                  `json:"version_id,omitempty"`
	ImageRef               *string                 `json:"image_ref,omitempty"`
	Exists                 *bool                   `json:"exists,omitempty"`
	ImageBuildingJobStatus *ImageBuildingJobStatus `json:"image_building_job_status,omitempty"`
}

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

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

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

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

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

	return false
}

// SetProjectId gets a reference to the given int32 and assigns it to the ProjectId field.
func (o *VersionImage) SetProjectId(v int32) {
	o.ProjectId = &v
}

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

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

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

	return false
}

// SetModelId gets a reference to the given int32 and assigns it to the ModelId field.
func (o *VersionImage) SetModelId(v int32) {
	o.ModelId = &v
}

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

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

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

	return false
}

// SetVersionId gets a reference to the given int32 and assigns it to the VersionId field.
func (o *VersionImage) SetVersionId(v int32) {
	o.VersionId = &v
}

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

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

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

	return false
}

// SetImageRef gets a reference to the given string and assigns it to the ImageRef field.
func (o *VersionImage) SetImageRef(v string) {
	o.ImageRef = &v
}

// GetExists returns the Exists field value if set, zero value otherwise.
func (o *VersionImage) GetExists() bool {
	if o == nil || IsNil(o.Exists) {
		var ret bool
		return ret
	}
	return *o.Exists
}

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

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

	return false
}

// SetExists gets a reference to the given bool and assigns it to the Exists field.
func (o *VersionImage) SetExists(v bool) {
	o.Exists = &v
}

// GetImageBuildingJobStatus returns the ImageBuildingJobStatus field value if set, zero value otherwise.
func (o *VersionImage) GetImageBuildingJobStatus() ImageBuildingJobStatus {
	if o == nil || IsNil(o.ImageBuildingJobStatus) {
		var ret ImageBuildingJobStatus
		return ret
	}
	return *o.ImageBuildingJobStatus
}

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

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

	return false
}

// SetImageBuildingJobStatus gets a reference to the given ImageBuildingJobStatus and assigns it to the ImageBuildingJobStatus field.
func (o *VersionImage) SetImageBuildingJobStatus(v ImageBuildingJobStatus) {
	o.ImageBuildingJobStatus = &v
}

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

func (o VersionImage) ToMap() (map[string]interface{}, error) {
	toSerialize := map[string]interface{}{}
	if !IsNil(o.ProjectId) {
		toSerialize["project_id"] = o.ProjectId
	}
	if !IsNil(o.ModelId) {
		toSerialize["model_id"] = o.ModelId
	}
	if !IsNil(o.VersionId) {
		toSerialize["version_id"] = o.VersionId
	}
	if !IsNil(o.ImageRef) {
		toSerialize["image_ref"] = o.ImageRef
	}
	if !IsNil(o.Exists) {
		toSerialize["exists"] = o.Exists
	}
	if !IsNil(o.ImageBuildingJobStatus) {
		toSerialize["image_building_job_status"] = o.ImageBuildingJobStatus
	}
	return toSerialize, nil
}

type NullableVersionImage struct {
	value *VersionImage
	isSet bool
}

func (v NullableVersionImage) Get() *VersionImage {
	return v.value
}

func (v *NullableVersionImage) Set(val *VersionImage) {
	v.value = val
	v.isSet = true
}

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

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

func NewNullableVersionImage(val *VersionImage) *NullableVersionImage {
	return &NullableVersionImage{value: val, isSet: true}
}

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

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