/*
Basic Svc

An example service for bootstrapping.

API version: 0.3.0-rc.8
Contact: sales@singulatron.com
*/

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

package openapi

import (
	"encoding/json"
	"bytes"
	"fmt"
)

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

// BasicSvcPet struct for BasicSvcPet
type BasicSvcPet struct {
	CreatedAt *string `json:"createdAt" binding:"required"`
	Id string `json:"id"`
	Name *string `json:"name,omitempty"`
	UpdatedAt *string `json:"updatedAt" binding:"required"`
}

type _BasicSvcPet BasicSvcPet

// NewBasicSvcPet instantiates a new BasicSvcPet 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 NewBasicSvcPet(id string) *BasicSvcPet {
	this := BasicSvcPet{}
	this.Id = id
	return &this
}

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

// GetCreatedAt returns the CreatedAt field value if set, zero value otherwise.
func (o *BasicSvcPet) GetCreatedAt() string {
	if o == nil || IsNil(o.CreatedAt) {
		var ret string
		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 *BasicSvcPet) GetCreatedAtOk() (*string, 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 *BasicSvcPet) HasCreatedAt() bool {
	if o != nil && !IsNil(o.CreatedAt) {
		return true
	}

	return false
}

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

// GetId returns the Id field value
func (o *BasicSvcPet) GetId() string {
	if o == nil {
		var ret string
		return ret
	}

	return o.Id
}

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

// SetId sets field value
func (o *BasicSvcPet) SetId(v string) {
	o.Id = v
}

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

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

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

	return false
}

// SetName gets a reference to the given string and assigns it to the Name field.
func (o *BasicSvcPet) SetName(v string) {
	o.Name = &v
}

// GetUpdatedAt returns the UpdatedAt field value if set, zero value otherwise.
func (o *BasicSvcPet) GetUpdatedAt() string {
	if o == nil || IsNil(o.UpdatedAt) {
		var ret string
		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 *BasicSvcPet) GetUpdatedAtOk() (*string, 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 *BasicSvcPet) HasUpdatedAt() bool {
	if o != nil && !IsNil(o.UpdatedAt) {
		return true
	}

	return false
}

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

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

func (o BasicSvcPet) ToMap() (map[string]interface{}, error) {
	toSerialize := map[string]interface{}{}
	if !IsNil(o.CreatedAt) {
		toSerialize["createdAt"] = o.CreatedAt
	}
	toSerialize["id"] = o.Id
	if !IsNil(o.Name) {
		toSerialize["name"] = o.Name
	}
	if !IsNil(o.UpdatedAt) {
		toSerialize["updatedAt"] = o.UpdatedAt
	}
	return toSerialize, nil
}

func (o *BasicSvcPet) UnmarshalJSON(data []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{
		"id",
	}

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

	err = json.Unmarshal(data, &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)
		}
	}

	varBasicSvcPet := _BasicSvcPet{}

	decoder := json.NewDecoder(bytes.NewReader(data))
	decoder.DisallowUnknownFields()
	err = decoder.Decode(&varBasicSvcPet)

	if err != nil {
		return err
	}

	*o = BasicSvcPet(varBasicSvcPet)

	return err
}

type NullableBasicSvcPet struct {
	value *BasicSvcPet
	isSet bool
}

func (v NullableBasicSvcPet) Get() *BasicSvcPet {
	return v.value
}

func (v *NullableBasicSvcPet) Set(val *BasicSvcPet) {
	v.value = val
	v.isSet = true
}

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

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

func NewNullableBasicSvcPet(val *BasicSvcPet) *NullableBasicSvcPet {
	return &NullableBasicSvcPet{value: val, isSet: true}
}

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

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


