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

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

// ModelEndpoint struct for ModelEndpoint
type ModelEndpoint struct {
	Id              *int32             `json:"id,omitempty"`
	ModelId         *int32             `json:"model_id,omitempty"`
	Model           *Model             `json:"model,omitempty"`
	Status          *EndpointStatus    `json:"status,omitempty"`
	Url             *string            `json:"url,omitempty"`
	Rule            *ModelEndpointRule `json:"rule,omitempty"`
	EnvironmentName *string            `json:"environment_name,omitempty"`
	Environment     *Environment       `json:"environment,omitempty"`
	Protocol        *Protocol          `json:"protocol,omitempty"`
	CreatedAt       *time.Time         `json:"created_at,omitempty"`
	UpdatedAt       *time.Time         `json:"updated_at,omitempty"`
}

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

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

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

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

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

	return false
}

// SetId gets a reference to the given int32 and assigns it to the Id field.
func (o *ModelEndpoint) SetId(v int32) {
	o.Id = &v
}

// GetModelId returns the ModelId field value if set, zero value otherwise.
func (o *ModelEndpoint) 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 *ModelEndpoint) 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 *ModelEndpoint) 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 *ModelEndpoint) SetModelId(v int32) {
	o.ModelId = &v
}

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

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

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

	return false
}

// SetModel gets a reference to the given Model and assigns it to the Model field.
func (o *ModelEndpoint) SetModel(v Model) {
	o.Model = &v
}

// GetStatus returns the Status field value if set, zero value otherwise.
func (o *ModelEndpoint) GetStatus() EndpointStatus {
	if o == nil || IsNil(o.Status) {
		var ret EndpointStatus
		return ret
	}
	return *o.Status
}

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

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

	return false
}

// SetStatus gets a reference to the given EndpointStatus and assigns it to the Status field.
func (o *ModelEndpoint) SetStatus(v EndpointStatus) {
	o.Status = &v
}

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

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

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

	return false
}

// SetUrl gets a reference to the given string and assigns it to the Url field.
func (o *ModelEndpoint) SetUrl(v string) {
	o.Url = &v
}

// GetRule returns the Rule field value if set, zero value otherwise.
func (o *ModelEndpoint) GetRule() ModelEndpointRule {
	if o == nil || IsNil(o.Rule) {
		var ret ModelEndpointRule
		return ret
	}
	return *o.Rule
}

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

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

	return false
}

// SetRule gets a reference to the given ModelEndpointRule and assigns it to the Rule field.
func (o *ModelEndpoint) SetRule(v ModelEndpointRule) {
	o.Rule = &v
}

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

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

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

	return false
}

// SetEnvironmentName gets a reference to the given string and assigns it to the EnvironmentName field.
func (o *ModelEndpoint) SetEnvironmentName(v string) {
	o.EnvironmentName = &v
}

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

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

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

	return false
}

// SetEnvironment gets a reference to the given Environment and assigns it to the Environment field.
func (o *ModelEndpoint) SetEnvironment(v Environment) {
	o.Environment = &v
}

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

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

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

	return false
}

// SetProtocol gets a reference to the given Protocol and assigns it to the Protocol field.
func (o *ModelEndpoint) SetProtocol(v Protocol) {
	o.Protocol = &v
}

// GetCreatedAt returns the CreatedAt field value if set, zero value otherwise.
func (o *ModelEndpoint) GetCreatedAt() time.Time {
	if o == nil || IsNil(o.CreatedAt) {
		var ret time.Time
		return ret
	}
	return *o.CreatedAt
}

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

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

	return false
}

// SetCreatedAt gets a reference to the given time.Time and assigns it to the CreatedAt field.
func (o *ModelEndpoint) SetCreatedAt(v time.Time) {
	o.CreatedAt = &v
}

// GetUpdatedAt returns the UpdatedAt field value if set, zero value otherwise.
func (o *ModelEndpoint) GetUpdatedAt() time.Time {
	if o == nil || IsNil(o.UpdatedAt) {
		var ret time.Time
		return ret
	}
	return *o.UpdatedAt
}

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

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

	return false
}

// SetUpdatedAt gets a reference to the given time.Time and assigns it to the UpdatedAt field.
func (o *ModelEndpoint) SetUpdatedAt(v time.Time) {
	o.UpdatedAt = &v
}

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

func (o ModelEndpoint) ToMap() (map[string]interface{}, error) {
	toSerialize := map[string]interface{}{}
	if !IsNil(o.Id) {
		toSerialize["id"] = o.Id
	}
	if !IsNil(o.ModelId) {
		toSerialize["model_id"] = o.ModelId
	}
	if !IsNil(o.Model) {
		toSerialize["model"] = o.Model
	}
	if !IsNil(o.Status) {
		toSerialize["status"] = o.Status
	}
	if !IsNil(o.Url) {
		toSerialize["url"] = o.Url
	}
	if !IsNil(o.Rule) {
		toSerialize["rule"] = o.Rule
	}
	if !IsNil(o.EnvironmentName) {
		toSerialize["environment_name"] = o.EnvironmentName
	}
	if !IsNil(o.Environment) {
		toSerialize["environment"] = o.Environment
	}
	if !IsNil(o.Protocol) {
		toSerialize["protocol"] = o.Protocol
	}
	if !IsNil(o.CreatedAt) {
		toSerialize["created_at"] = o.CreatedAt
	}
	if !IsNil(o.UpdatedAt) {
		toSerialize["updated_at"] = o.UpdatedAt
	}
	return toSerialize, nil
}

type NullableModelEndpoint struct {
	value *ModelEndpoint
	isSet bool
}

func (v NullableModelEndpoint) Get() *ModelEndpoint {
	return v.value
}

func (v *NullableModelEndpoint) Set(val *ModelEndpoint) {
	v.value = val
	v.isSet = true
}

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

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

func NewNullableModelEndpoint(val *ModelEndpoint) *NullableModelEndpoint {
	return &NullableModelEndpoint{value: val, isSet: true}
}

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

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