/*
Daytona

Daytona AI platform API Docs

API version: 1.0
Contact: support@daytona.com
*/

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

package apiclient

import (
	"encoding/json"
	"fmt"
)

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

// GitCommitInfo struct for GitCommitInfo
type GitCommitInfo struct {
	Hash string `json:"hash"`
	Message string `json:"message"`
	Author string `json:"author"`
	Email string `json:"email"`
	Timestamp string `json:"timestamp"`
	AdditionalProperties map[string]interface{}
}

type _GitCommitInfo GitCommitInfo

// NewGitCommitInfo instantiates a new GitCommitInfo 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 NewGitCommitInfo(hash string, message string, author string, email string, timestamp string) *GitCommitInfo {
	this := GitCommitInfo{}
	this.Hash = hash
	this.Message = message
	this.Author = author
	this.Email = email
	this.Timestamp = timestamp
	return &this
}

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

// GetHash returns the Hash field value
func (o *GitCommitInfo) GetHash() string {
	if o == nil {
		var ret string
		return ret
	}

	return o.Hash
}

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

// SetHash sets field value
func (o *GitCommitInfo) SetHash(v string) {
	o.Hash = v
}

// GetMessage returns the Message field value
func (o *GitCommitInfo) GetMessage() string {
	if o == nil {
		var ret string
		return ret
	}

	return o.Message
}

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

// SetMessage sets field value
func (o *GitCommitInfo) SetMessage(v string) {
	o.Message = v
}

// GetAuthor returns the Author field value
func (o *GitCommitInfo) GetAuthor() string {
	if o == nil {
		var ret string
		return ret
	}

	return o.Author
}

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

// SetAuthor sets field value
func (o *GitCommitInfo) SetAuthor(v string) {
	o.Author = v
}

// GetEmail returns the Email field value
func (o *GitCommitInfo) GetEmail() string {
	if o == nil {
		var ret string
		return ret
	}

	return o.Email
}

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

// SetEmail sets field value
func (o *GitCommitInfo) SetEmail(v string) {
	o.Email = v
}

// GetTimestamp returns the Timestamp field value
func (o *GitCommitInfo) GetTimestamp() string {
	if o == nil {
		var ret string
		return ret
	}

	return o.Timestamp
}

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

// SetTimestamp sets field value
func (o *GitCommitInfo) SetTimestamp(v string) {
	o.Timestamp = v
}

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

func (o GitCommitInfo) ToMap() (map[string]interface{}, error) {
	toSerialize := map[string]interface{}{}
	toSerialize["hash"] = o.Hash
	toSerialize["message"] = o.Message
	toSerialize["author"] = o.Author
	toSerialize["email"] = o.Email
	toSerialize["timestamp"] = o.Timestamp

	for key, value := range o.AdditionalProperties {
		toSerialize[key] = value
	}

	return toSerialize, nil
}

func (o *GitCommitInfo) 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{
		"hash",
		"message",
		"author",
		"email",
		"timestamp",
	}

	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)
		}
	}

	varGitCommitInfo := _GitCommitInfo{}

	err = json.Unmarshal(data, &varGitCommitInfo)

	if err != nil {
		return err
	}

	*o = GitCommitInfo(varGitCommitInfo)

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

	if err = json.Unmarshal(data, &additionalProperties); err == nil {
		delete(additionalProperties, "hash")
		delete(additionalProperties, "message")
		delete(additionalProperties, "author")
		delete(additionalProperties, "email")
		delete(additionalProperties, "timestamp")
		o.AdditionalProperties = additionalProperties
	}

	return err
}

type NullableGitCommitInfo struct {
	value *GitCommitInfo
	isSet bool
}

func (v NullableGitCommitInfo) Get() *GitCommitInfo {
	return v.value
}

func (v *NullableGitCommitInfo) Set(val *GitCommitInfo) {
	v.value = val
	v.isSet = true
}

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

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

func NewNullableGitCommitInfo(val *GitCommitInfo) *NullableGitCommitInfo {
	return &NullableGitCommitInfo{value: val, isSet: true}
}

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

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


