/*
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"
	"fmt"
)

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

// ListJobsPaginatedResponse struct for ListJobsPaginatedResponse
type ListJobsPaginatedResponse struct {
	Results []PredictionJob `json:"results"`
	Paging  Paging          `json:"paging"`
}

type _ListJobsPaginatedResponse ListJobsPaginatedResponse

// NewListJobsPaginatedResponse instantiates a new ListJobsPaginatedResponse 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 NewListJobsPaginatedResponse(results []PredictionJob, paging Paging) *ListJobsPaginatedResponse {
	this := ListJobsPaginatedResponse{}
	this.Results = results
	this.Paging = paging
	return &this
}

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

// GetResults returns the Results field value
func (o *ListJobsPaginatedResponse) GetResults() []PredictionJob {
	if o == nil {
		var ret []PredictionJob
		return ret
	}

	return o.Results
}

// GetResultsOk returns a tuple with the Results field value
// and a boolean to check if the value has been set.
func (o *ListJobsPaginatedResponse) GetResultsOk() ([]PredictionJob, bool) {
	if o == nil {
		return nil, false
	}
	return o.Results, true
}

// SetResults sets field value
func (o *ListJobsPaginatedResponse) SetResults(v []PredictionJob) {
	o.Results = v
}

// GetPaging returns the Paging field value
func (o *ListJobsPaginatedResponse) GetPaging() Paging {
	if o == nil {
		var ret Paging
		return ret
	}

	return o.Paging
}

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

// SetPaging sets field value
func (o *ListJobsPaginatedResponse) SetPaging(v Paging) {
	o.Paging = v
}

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

func (o ListJobsPaginatedResponse) ToMap() (map[string]interface{}, error) {
	toSerialize := map[string]interface{}{}
	toSerialize["results"] = o.Results
	toSerialize["paging"] = o.Paging
	return toSerialize, nil
}

func (o *ListJobsPaginatedResponse) UnmarshalJSON(bytes []byte) (err error) {
	// This validates that all required properties are included in the JSON object
	// by unmarshalling the object into a generic map with string keys and checking
	// that every required field exists as a key in the generic map.
	requiredProperties := []string{
		"results",
		"paging",
	}

	allProperties := make(map[string]interface{})

	err = json.Unmarshal(bytes, &allProperties)

	if err != nil {
		return err
	}

	for _, requiredProperty := range requiredProperties {
		if _, exists := allProperties[requiredProperty]; !exists {
			return fmt.Errorf("no value given for required property %v", requiredProperty)
		}
	}

	varListJobsPaginatedResponse := _ListJobsPaginatedResponse{}

	err = json.Unmarshal(bytes, &varListJobsPaginatedResponse)

	if err != nil {
		return err
	}

	*o = ListJobsPaginatedResponse(varListJobsPaginatedResponse)

	return err
}

type NullableListJobsPaginatedResponse struct {
	value *ListJobsPaginatedResponse
	isSet bool
}

func (v NullableListJobsPaginatedResponse) Get() *ListJobsPaginatedResponse {
	return v.value
}

func (v *NullableListJobsPaginatedResponse) Set(val *ListJobsPaginatedResponse) {
	v.value = val
	v.isSet = true
}

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

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

func NewNullableListJobsPaginatedResponse(val *ListJobsPaginatedResponse) *NullableListJobsPaginatedResponse {
	return &NullableListJobsPaginatedResponse{value: val, isSet: true}
}

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

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