// 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"
	"github.com/go-openapi/validate"
)

// RemoteCopyRelationship remote copy relationship
//
// swagger:model RemoteCopyRelationship
type RemoteCopyRelationship struct {

	// Name of the volume that is acting as the auxiliary change volume for the relationship
	AuxChangedVolumeName string `json:"auxChangedVolumeName,omitempty"`

	// Auxiliary volume name at storage host level
	AuxVolumeName string `json:"auxVolumeName,omitempty"`

	// Consistency Group Name if volume is a part of volume group
	ConsistencyGroupName string `json:"consistencyGroupName,omitempty"`

	// Indicates the copy type.
	CopyType string `json:"copyType,omitempty"`

	// Indicates the type of cycling mode used.
	CyclingMode string `json:"cyclingMode,omitempty"`

	// Freeze time of remote copy relationship
	// Format: date-time
	FreezeTime strfmt.DateTime `json:"freezeTime,omitempty"`

	// Name of the volume that is acting as the master change volume for the relationship
	MasterChangedVolumeName string `json:"masterChangedVolumeName,omitempty"`

	// Master volume name at storage host level
	MasterVolumeName string `json:"masterVolumeName,omitempty"`

	// Remote copy relationship name
	// Required: true
	Name *string `json:"name"`

	// Indicates whether master/aux volume is playing the primary role
	PrimaryRole string `json:"primaryRole,omitempty"`

	// Indicates the relationship progress
	Progress int64 `json:"progress,omitempty"`

	// Remote copy relationship ID
	// Required: true
	RemoteCopyID *string `json:"remoteCopyID"`

	// Indicates the relationship state
	State string `json:"state,omitempty"`

	// Indicates whether the relationship is synchronized
	Sync string `json:"sync,omitempty"`
}

// Validate validates this remote copy relationship
func (m *RemoteCopyRelationship) Validate(formats strfmt.Registry) error {
	var res []error

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

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

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

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

func (m *RemoteCopyRelationship) validateFreezeTime(formats strfmt.Registry) error {
	if swag.IsZero(m.FreezeTime) { // not required
		return nil
	}

	if err := validate.FormatOf("freezeTime", "body", "date-time", m.FreezeTime.String(), formats); err != nil {
		return err
	}

	return nil
}

func (m *RemoteCopyRelationship) validateName(formats strfmt.Registry) error {

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

	return nil
}

func (m *RemoteCopyRelationship) validateRemoteCopyID(formats strfmt.Registry) error {

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

	return nil
}

// ContextValidate validates this remote copy relationship based on context it is used
func (m *RemoteCopyRelationship) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
	return nil
}

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

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