/*
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 DumpStatus type satisfies the MappedNullable interface at compile time
var _ MappedNullable = &DumpStatus{}

// DumpStatus status of dump unit
type DumpStatus struct {
	Bps               int64   `json:"bps"`
	CompletedTables   float64 `json:"completed_tables"`
	EstimateTotalRows float64 `json:"estimate_total_rows"`
	FinishedBytes     float64 `json:"finished_bytes"`
	FinishedRows      float64 `json:"finished_rows"`
	Progress          string  `json:"progress"`
	TotalTables       int64   `json:"total_tables"`
}

type _DumpStatus DumpStatus

// NewDumpStatus instantiates a new DumpStatus 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 NewDumpStatus(bps int64, completedTables float64, estimateTotalRows float64, finishedBytes float64, finishedRows float64, progress string, totalTables int64) *DumpStatus {
	this := DumpStatus{}
	this.Bps = bps
	this.CompletedTables = completedTables
	this.EstimateTotalRows = estimateTotalRows
	this.FinishedBytes = finishedBytes
	this.FinishedRows = finishedRows
	this.Progress = progress
	this.TotalTables = totalTables
	return &this
}

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

// GetBps returns the Bps field value
func (o *DumpStatus) GetBps() int64 {
	if o == nil {
		var ret int64
		return ret
	}

	return o.Bps
}

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

// SetBps sets field value
func (o *DumpStatus) SetBps(v int64) {
	o.Bps = v
}

// GetCompletedTables returns the CompletedTables field value
func (o *DumpStatus) GetCompletedTables() float64 {
	if o == nil {
		var ret float64
		return ret
	}

	return o.CompletedTables
}

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

// SetCompletedTables sets field value
func (o *DumpStatus) SetCompletedTables(v float64) {
	o.CompletedTables = v
}

// GetEstimateTotalRows returns the EstimateTotalRows field value
func (o *DumpStatus) GetEstimateTotalRows() float64 {
	if o == nil {
		var ret float64
		return ret
	}

	return o.EstimateTotalRows
}

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

// SetEstimateTotalRows sets field value
func (o *DumpStatus) SetEstimateTotalRows(v float64) {
	o.EstimateTotalRows = v
}

// GetFinishedBytes returns the FinishedBytes field value
func (o *DumpStatus) GetFinishedBytes() float64 {
	if o == nil {
		var ret float64
		return ret
	}

	return o.FinishedBytes
}

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

// SetFinishedBytes sets field value
func (o *DumpStatus) SetFinishedBytes(v float64) {
	o.FinishedBytes = v
}

// GetFinishedRows returns the FinishedRows field value
func (o *DumpStatus) GetFinishedRows() float64 {
	if o == nil {
		var ret float64
		return ret
	}

	return o.FinishedRows
}

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

// SetFinishedRows sets field value
func (o *DumpStatus) SetFinishedRows(v float64) {
	o.FinishedRows = v
}

// GetProgress returns the Progress field value
func (o *DumpStatus) GetProgress() string {
	if o == nil {
		var ret string
		return ret
	}

	return o.Progress
}

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

// SetProgress sets field value
func (o *DumpStatus) SetProgress(v string) {
	o.Progress = v
}

// GetTotalTables returns the TotalTables field value
func (o *DumpStatus) GetTotalTables() int64 {
	if o == nil {
		var ret int64
		return ret
	}

	return o.TotalTables
}

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

// SetTotalTables sets field value
func (o *DumpStatus) SetTotalTables(v int64) {
	o.TotalTables = v
}

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

func (o DumpStatus) ToMap() (map[string]interface{}, error) {
	toSerialize := map[string]interface{}{}
	toSerialize["bps"] = o.Bps
	toSerialize["completed_tables"] = o.CompletedTables
	toSerialize["estimate_total_rows"] = o.EstimateTotalRows
	toSerialize["finished_bytes"] = o.FinishedBytes
	toSerialize["finished_rows"] = o.FinishedRows
	toSerialize["progress"] = o.Progress
	toSerialize["total_tables"] = o.TotalTables
	return toSerialize, nil
}

func (o *DumpStatus) 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{
		"bps",
		"completed_tables",
		"estimate_total_rows",
		"finished_bytes",
		"finished_rows",
		"progress",
		"total_tables",
	}

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

	varDumpStatus := _DumpStatus{}

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

	if err != nil {
		return err
	}

	*o = DumpStatus(varDumpStatus)

	return err
}

type NullableDumpStatus struct {
	value *DumpStatus
	isSet bool
}

func (v NullableDumpStatus) Get() *DumpStatus {
	return v.value
}

func (v *NullableDumpStatus) Set(val *DumpStatus) {
	v.value = val
	v.isSet = true
}

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

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

func NewNullableDumpStatus(val *DumpStatus) *NullableDumpStatus {
	return &NullableDumpStatus{value: val, isSet: true}
}

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

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