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

// HashicorpCloudIamVerifyDomainOwnershipResponse VerifyDomainOwnershipResponse is the response containing whether an
// organization's ownership/control of a domain has been verified.
//
// swagger:model hashicorp.cloud.iam.VerifyDomainOwnershipResponse
type HashicorpCloudIamVerifyDomainOwnershipResponse struct {

	// domain is the domain for which the ownership has been verified.
	Domain string `json:"domain,omitempty"`

	// reason
	Reason *HashicorpCloudIamVerifyDomainOwnershipResponseReasonDomainOwnershipUnverified `json:"reason,omitempty"`

	// verified indicates whether or not an organization's ownership/control of
	// a domain has been verified.
	Verified bool `json:"verified,omitempty"`
}

// Validate validates this hashicorp cloud iam verify domain ownership response
func (m *HashicorpCloudIamVerifyDomainOwnershipResponse) Validate(formats strfmt.Registry) error {
	var res []error

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

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

func (m *HashicorpCloudIamVerifyDomainOwnershipResponse) validateReason(formats strfmt.Registry) error {
	if swag.IsZero(m.Reason) { // not required
		return nil
	}

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

	return nil
}

// ContextValidate validate this hashicorp cloud iam verify domain ownership response based on the context it is used
func (m *HashicorpCloudIamVerifyDomainOwnershipResponse) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
	var res []error

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

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

func (m *HashicorpCloudIamVerifyDomainOwnershipResponse) contextValidateReason(ctx context.Context, formats strfmt.Registry) error {

	if m.Reason != nil {

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

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

	return nil
}

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

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