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

// FlashCopyMapping flash copy mapping
//
// swagger:model FlashCopyMapping
type FlashCopyMapping struct {

	// Indicates the rate of flash copy operation of a volume
	CopyRate int64 `json:"copyRate,omitempty"`

	// Indicates flash copy name of the volume
	// Required: true
	FlashCopyName *string `json:"flashCopyName"`

	// Indicates the progress of flash copy operation
	Progress int64 `json:"progress,omitempty"`

	// Indicates name of the source volume
	SourceVolumeName string `json:"sourceVolumeName,omitempty"`

	// Indicates the start time of flash copy operation
	// Format: date-time
	StartTime strfmt.DateTime `json:"startTime,omitempty"`

	// Copy status of a volume
	Status string `json:"status,omitempty"`

	// Indicates name of the target volume
	TargetVolumeName string `json:"targetVolumeName,omitempty"`
}

// Validate validates this flash copy mapping
func (m *FlashCopyMapping) Validate(formats strfmt.Registry) error {
	var res []error

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

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

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

func (m *FlashCopyMapping) validateFlashCopyName(formats strfmt.Registry) error {

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

	return nil
}

func (m *FlashCopyMapping) validateStartTime(formats strfmt.Registry) error {
	if swag.IsZero(m.StartTime) { // not required
		return nil
	}

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

	return nil
}

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

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

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