// 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"
)

// HashicorpCloudVagrant20220930DownloadBoxResponse hashicorp cloud vagrant 20220930 download box response
//
// swagger:model hashicorp.cloud.vagrant_20220930.DownloadBoxResponse
type HashicorpCloudVagrant20220930DownloadBoxResponse struct {

	// (Optional) checksum data to validate the download with.
	Checksum string `json:"checksum,omitempty"`

	// The algorithm type for the provided checksum.
	ChecksumType *HashicorpCloudVagrant20220930ChecksumType `json:"checksum_type,omitempty"`

	// The URL to download the Architecture data from.
	URL string `json:"url,omitempty"`
}

// Validate validates this hashicorp cloud vagrant 20220930 download box response
func (m *HashicorpCloudVagrant20220930DownloadBoxResponse) Validate(formats strfmt.Registry) error {
	var res []error

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

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

func (m *HashicorpCloudVagrant20220930DownloadBoxResponse) validateChecksumType(formats strfmt.Registry) error {
	if swag.IsZero(m.ChecksumType) { // not required
		return nil
	}

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

	return nil
}

// ContextValidate validate this hashicorp cloud vagrant 20220930 download box response based on the context it is used
func (m *HashicorpCloudVagrant20220930DownloadBoxResponse) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
	var res []error

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

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

func (m *HashicorpCloudVagrant20220930DownloadBoxResponse) contextValidateChecksumType(ctx context.Context, formats strfmt.Registry) error {

	if m.ChecksumType != nil {

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

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

	return nil
}

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

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