/*
Adyen Checkout API

API version: 71
*/

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

package checkout

import (
	"encoding/json"

	"github.com/adyen/adyen-go-api-library/v21/src/common"
)

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

// Ticket struct for Ticket
type Ticket struct {
	// The address of the organization that issued the ticket. * minLength: 0 characters * maxLength: 16 characters
	IssueAddress *string `json:"issueAddress,omitempty"`
	// The date that the ticket was issued to the passenger. * minLength: 10 characters * maxLength: 10 characters * Format [ISO 8601](https://www.w3.org/TR/NOTE-datetime): yyyy-MM-dd
	IssueDate *string `json:"issueDate,omitempty"`
	// The ticket's unique identifier. * minLength: 1 character * maxLength: 15 characters * Must not start with a space or be all spaces. * Must not be all zeros.
	Number *string `json:"number,omitempty"`
}

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

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

// GetIssueAddress returns the IssueAddress field value if set, zero value otherwise.
func (o *Ticket) GetIssueAddress() string {
	if o == nil || common.IsNil(o.IssueAddress) {
		var ret string
		return ret
	}
	return *o.IssueAddress
}

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

// HasIssueAddress returns a boolean if a field has been set.
func (o *Ticket) HasIssueAddress() bool {
	if o != nil && !common.IsNil(o.IssueAddress) {
		return true
	}

	return false
}

// SetIssueAddress gets a reference to the given string and assigns it to the IssueAddress field.
func (o *Ticket) SetIssueAddress(v string) {
	o.IssueAddress = &v
}

// GetIssueDate returns the IssueDate field value if set, zero value otherwise.
func (o *Ticket) GetIssueDate() string {
	if o == nil || common.IsNil(o.IssueDate) {
		var ret string
		return ret
	}
	return *o.IssueDate
}

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

// HasIssueDate returns a boolean if a field has been set.
func (o *Ticket) HasIssueDate() bool {
	if o != nil && !common.IsNil(o.IssueDate) {
		return true
	}

	return false
}

// SetIssueDate gets a reference to the given string and assigns it to the IssueDate field.
func (o *Ticket) SetIssueDate(v string) {
	o.IssueDate = &v
}

// GetNumber returns the Number field value if set, zero value otherwise.
func (o *Ticket) GetNumber() string {
	if o == nil || common.IsNil(o.Number) {
		var ret string
		return ret
	}
	return *o.Number
}

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

// HasNumber returns a boolean if a field has been set.
func (o *Ticket) HasNumber() bool {
	if o != nil && !common.IsNil(o.Number) {
		return true
	}

	return false
}

// SetNumber gets a reference to the given string and assigns it to the Number field.
func (o *Ticket) SetNumber(v string) {
	o.Number = &v
}

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

func (o Ticket) ToMap() (map[string]interface{}, error) {
	toSerialize := map[string]interface{}{}
	if !common.IsNil(o.IssueAddress) {
		toSerialize["issueAddress"] = o.IssueAddress
	}
	if !common.IsNil(o.IssueDate) {
		toSerialize["issueDate"] = o.IssueDate
	}
	if !common.IsNil(o.Number) {
		toSerialize["number"] = o.Number
	}
	return toSerialize, nil
}

type NullableTicket struct {
	value *Ticket
	isSet bool
}

func (v NullableTicket) Get() *Ticket {
	return v.value
}

func (v *NullableTicket) Set(val *Ticket) {
	v.value = val
	v.isSet = true
}

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

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

func NewNullableTicket(val *Ticket) *NullableTicket {
	return &NullableTicket{value: val, isSet: true}
}

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

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