/*
Management API

API version: 3
*/

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

package management

import (
	"encoding/json"

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

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

// TerminalAssignment struct for TerminalAssignment
type TerminalAssignment struct {
	// The unique identifier of the company account to which terminal is assigned.
	CompanyId string `json:"companyId"`
	// The unique identifier of the merchant account to which terminal is assigned.
	MerchantId         *string                     `json:"merchantId,omitempty"`
	ReassignmentTarget *TerminalReassignmentTarget `json:"reassignmentTarget,omitempty"`
	// The status of the reassignment. Possible values:   * `reassignmentInProgress`: the terminal was boarded and is now scheduled to remove the configuration. Wait for the terminal to synchronize with the Adyen platform.  * `deployed`: the terminal is deployed and reassigned.   * `inventory`: the terminal is in inventory and cannot process transactions.   * `boarded`: the terminal is boarded to a store, or a merchant account representing a store, and can process transactions.
	Status string `json:"status"`
	// The unique identifier of the store to which terminal is assigned.
	StoreId *string `json:"storeId,omitempty"`
}

// NewTerminalAssignment instantiates a new TerminalAssignment 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 NewTerminalAssignment(companyId string, status string) *TerminalAssignment {
	this := TerminalAssignment{}
	this.CompanyId = companyId
	this.Status = status
	return &this
}

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

// GetCompanyId returns the CompanyId field value
func (o *TerminalAssignment) GetCompanyId() string {
	if o == nil {
		var ret string
		return ret
	}

	return o.CompanyId
}

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

// SetCompanyId sets field value
func (o *TerminalAssignment) SetCompanyId(v string) {
	o.CompanyId = v
}

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

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

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

	return false
}

// SetMerchantId gets a reference to the given string and assigns it to the MerchantId field.
func (o *TerminalAssignment) SetMerchantId(v string) {
	o.MerchantId = &v
}

// GetReassignmentTarget returns the ReassignmentTarget field value if set, zero value otherwise.
func (o *TerminalAssignment) GetReassignmentTarget() TerminalReassignmentTarget {
	if o == nil || common.IsNil(o.ReassignmentTarget) {
		var ret TerminalReassignmentTarget
		return ret
	}
	return *o.ReassignmentTarget
}

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

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

	return false
}

// SetReassignmentTarget gets a reference to the given TerminalReassignmentTarget and assigns it to the ReassignmentTarget field.
func (o *TerminalAssignment) SetReassignmentTarget(v TerminalReassignmentTarget) {
	o.ReassignmentTarget = &v
}

// GetStatus returns the Status field value
func (o *TerminalAssignment) GetStatus() string {
	if o == nil {
		var ret string
		return ret
	}

	return o.Status
}

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

// SetStatus sets field value
func (o *TerminalAssignment) SetStatus(v string) {
	o.Status = v
}

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

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

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

	return false
}

// SetStoreId gets a reference to the given string and assigns it to the StoreId field.
func (o *TerminalAssignment) SetStoreId(v string) {
	o.StoreId = &v
}

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

func (o TerminalAssignment) ToMap() (map[string]interface{}, error) {
	toSerialize := map[string]interface{}{}
	toSerialize["companyId"] = o.CompanyId
	if !common.IsNil(o.MerchantId) {
		toSerialize["merchantId"] = o.MerchantId
	}
	if !common.IsNil(o.ReassignmentTarget) {
		toSerialize["reassignmentTarget"] = o.ReassignmentTarget
	}
	toSerialize["status"] = o.Status
	if !common.IsNil(o.StoreId) {
		toSerialize["storeId"] = o.StoreId
	}
	return toSerialize, nil
}

type NullableTerminalAssignment struct {
	value *TerminalAssignment
	isSet bool
}

func (v NullableTerminalAssignment) Get() *TerminalAssignment {
	return v.value
}

func (v *NullableTerminalAssignment) Set(val *TerminalAssignment) {
	v.value = val
	v.isSet = true
}

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

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

func NewNullableTerminalAssignment(val *TerminalAssignment) *NullableTerminalAssignment {
	return &NullableTerminalAssignment{value: val, isSet: true}
}

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

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

func (o *TerminalAssignment) isValidStatus() bool {
	var allowedEnumValues = []string{"boarded", "deployed", "inventory", "reassignmentInProgress"}
	for _, allowed := range allowedEnumValues {
		if o.GetStatus() == allowed {
			return true
		}
	}
	return false
}
