/*
DM OpenAPI DOC

No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)

API version: 6.0.0
*/

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

package dm

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

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

// GetTaskStatusResponse struct for GetTaskStatusResponse
type GetTaskStatusResponse struct {
	Data  []SubTaskStatus `json:"data"`
	Total int32           `json:"total"`
}

type _GetTaskStatusResponse GetTaskStatusResponse

// NewGetTaskStatusResponse instantiates a new GetTaskStatusResponse 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 NewGetTaskStatusResponse(data []SubTaskStatus, total int32) *GetTaskStatusResponse {
	this := GetTaskStatusResponse{}
	this.Data = data
	this.Total = total
	return &this
}

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

// GetData returns the Data field value
func (o *GetTaskStatusResponse) GetData() []SubTaskStatus {
	if o == nil {
		var ret []SubTaskStatus
		return ret
	}

	return o.Data
}

// GetDataOk returns a tuple with the Data field value
// and a boolean to check if the value has been set.
func (o *GetTaskStatusResponse) GetDataOk() ([]SubTaskStatus, bool) {
	if o == nil {
		return nil, false
	}
	return o.Data, true
}

// SetData sets field value
func (o *GetTaskStatusResponse) SetData(v []SubTaskStatus) {
	o.Data = v
}

// GetTotal returns the Total field value
func (o *GetTaskStatusResponse) GetTotal() int32 {
	if o == nil {
		var ret int32
		return ret
	}

	return o.Total
}

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

// SetTotal sets field value
func (o *GetTaskStatusResponse) SetTotal(v int32) {
	o.Total = v
}

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

func (o GetTaskStatusResponse) ToMap() (map[string]interface{}, error) {
	toSerialize := map[string]interface{}{}
	toSerialize["data"] = o.Data
	toSerialize["total"] = o.Total
	return toSerialize, nil
}

func (o *GetTaskStatusResponse) 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{
		"data",
		"total",
	}

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

	varGetTaskStatusResponse := _GetTaskStatusResponse{}

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

	if err != nil {
		return err
	}

	*o = GetTaskStatusResponse(varGetTaskStatusResponse)

	return err
}

type NullableGetTaskStatusResponse struct {
	value *GetTaskStatusResponse
	isSet bool
}

func (v NullableGetTaskStatusResponse) Get() *GetTaskStatusResponse {
	return v.value
}

func (v *NullableGetTaskStatusResponse) Set(val *GetTaskStatusResponse) {
	v.value = val
	v.isSet = true
}

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

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

func NewNullableGetTaskStatusResponse(val *GetTaskStatusResponse) *NullableGetTaskStatusResponse {
	return &NullableGetTaskStatusResponse{value: val, isSet: true}
}

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

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