// 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 (
	"context"

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

// HashicorpCloudVault20201125MinorVersionUpgradeConfigMaintenanceWindow hashicorp cloud vault 20201125 minor version upgrade config maintenance window
//
// swagger:model hashicorp.cloud.vault_20201125.MinorVersionUpgradeConfig.MaintenanceWindow
type HashicorpCloudVault20201125MinorVersionUpgradeConfigMaintenanceWindow struct {

	// day of week
	DayOfWeek *HashicorpCloudVault20201125MinorVersionUpgradeConfigMaintenanceWindowDayOfWeek `json:"day_of_week,omitempty"`

	// time window utc
	TimeWindowUtc *HashicorpCloudVault20201125MinorVersionUpgradeConfigMaintenanceWindowTimeWindowUTC `json:"time_window_utc,omitempty"`
}

// Validate validates this hashicorp cloud vault 20201125 minor version upgrade config maintenance window
func (m *HashicorpCloudVault20201125MinorVersionUpgradeConfigMaintenanceWindow) Validate(formats strfmt.Registry) error {
	var res []error

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

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

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

func (m *HashicorpCloudVault20201125MinorVersionUpgradeConfigMaintenanceWindow) validateDayOfWeek(formats strfmt.Registry) error {
	if swag.IsZero(m.DayOfWeek) { // not required
		return nil
	}

	if m.DayOfWeek != nil {
		if err := m.DayOfWeek.Validate(formats); err != nil {
			if ve, ok := err.(*errors.Validation); ok {
				return ve.ValidateName("day_of_week")
			} else if ce, ok := err.(*errors.CompositeError); ok {
				return ce.ValidateName("day_of_week")
			}
			return err
		}
	}

	return nil
}

func (m *HashicorpCloudVault20201125MinorVersionUpgradeConfigMaintenanceWindow) validateTimeWindowUtc(formats strfmt.Registry) error {
	if swag.IsZero(m.TimeWindowUtc) { // not required
		return nil
	}

	if m.TimeWindowUtc != nil {
		if err := m.TimeWindowUtc.Validate(formats); err != nil {
			if ve, ok := err.(*errors.Validation); ok {
				return ve.ValidateName("time_window_utc")
			} else if ce, ok := err.(*errors.CompositeError); ok {
				return ce.ValidateName("time_window_utc")
			}
			return err
		}
	}

	return nil
}

// ContextValidate validate this hashicorp cloud vault 20201125 minor version upgrade config maintenance window based on the context it is used
func (m *HashicorpCloudVault20201125MinorVersionUpgradeConfigMaintenanceWindow) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
	var res []error

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

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

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

func (m *HashicorpCloudVault20201125MinorVersionUpgradeConfigMaintenanceWindow) contextValidateDayOfWeek(ctx context.Context, formats strfmt.Registry) error {

	if m.DayOfWeek != nil {

		if swag.IsZero(m.DayOfWeek) { // not required
			return nil
		}

		if err := m.DayOfWeek.ContextValidate(ctx, formats); err != nil {
			if ve, ok := err.(*errors.Validation); ok {
				return ve.ValidateName("day_of_week")
			} else if ce, ok := err.(*errors.CompositeError); ok {
				return ce.ValidateName("day_of_week")
			}
			return err
		}
	}

	return nil
}

func (m *HashicorpCloudVault20201125MinorVersionUpgradeConfigMaintenanceWindow) contextValidateTimeWindowUtc(ctx context.Context, formats strfmt.Registry) error {

	if m.TimeWindowUtc != nil {

		if swag.IsZero(m.TimeWindowUtc) { // not required
			return nil
		}

		if err := m.TimeWindowUtc.ContextValidate(ctx, formats); err != nil {
			if ve, ok := err.(*errors.Validation); ok {
				return ve.ValidateName("time_window_utc")
			} else if ce, ok := err.(*errors.CompositeError); ok {
				return ce.ValidateName("time_window_utc")
			}
			return err
		}
	}

	return nil
}

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

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