// Code generated by go-swagger; DO NOT EDIT.

package models

// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command

import (
	"github.com/go-openapi/errors"
	"github.com/go-openapi/strfmt"
	"github.com/go-openapi/swag"
	"github.com/go-openapi/validate"
)

// CentralAutoBackupSetting central auto backup setting
//
// swagger:model centralAutoBackupSetting
type CentralAutoBackupSetting struct {

	// backup mode
	// Required: true
	BackupMode CentralBackupMode `json:"backup_mode"`

	// backup time
	// Required: true
	BackupTime *string `json:"backup_time"`

	// max backups
	// Required: true
	MaxBackups *string `json:"max_backups"`
}

// Validate validates this central auto backup setting
func (m *CentralAutoBackupSetting) Validate(formats strfmt.Registry) error {
	var res []error

	if err := m.validateBackupMode(formats); err != nil {
		res = append(res, err)
	}

	if err := m.validateBackupTime(formats); err != nil {
		res = append(res, err)
	}

	if err := m.validateMaxBackups(formats); err != nil {
		res = append(res, err)
	}

	if len(res) > 0 {
		return errors.CompositeValidationError(res...)
	}
	return nil
}

func (m *CentralAutoBackupSetting) validateBackupMode(formats strfmt.Registry) error {

	if err := m.BackupMode.Validate(formats); err != nil {
		if ve, ok := err.(*errors.Validation); ok {
			return ve.ValidateName("backup_mode")
		}
		return err
	}

	return nil
}

func (m *CentralAutoBackupSetting) validateBackupTime(formats strfmt.Registry) error {

	if err := validate.Required("backup_time", "body", m.BackupTime); err != nil {
		return err
	}

	return nil
}

func (m *CentralAutoBackupSetting) validateMaxBackups(formats strfmt.Registry) error {

	if err := validate.Required("max_backups", "body", m.MaxBackups); err != nil {
		return err
	}

	return nil
}

// MarshalBinary interface implementation
func (m *CentralAutoBackupSetting) MarshalBinary() ([]byte, error) {
	if m == nil {
		return nil, nil
	}
	return swag.WriteJSON(m)
}

// UnmarshalBinary interface implementation
func (m *CentralAutoBackupSetting) UnmarshalBinary(b []byte) error {
	var res CentralAutoBackupSetting
	if err := swag.ReadJSON(b, &res); err != nil {
		return err
	}
	*m = res
	return nil
}
