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

// DataflowPiTRTimeRange dataflow pi t r time range
//
// swagger:model dataflowPiTRTimeRange
type DataflowPiTRTimeRange struct {

	// end ts
	// Format: date-time
	EndTs strfmt.DateTime `json:"end_ts,omitempty"`

	// start ts
	// Format: date-time
	StartTs strfmt.DateTime `json:"start_ts,omitempty"`
}

// Validate validates this dataflow pi t r time range
func (m *DataflowPiTRTimeRange) Validate(formats strfmt.Registry) error {
	var res []error

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

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

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

func (m *DataflowPiTRTimeRange) validateEndTs(formats strfmt.Registry) error {
	if swag.IsZero(m.EndTs) { // not required
		return nil
	}

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

	return nil
}

func (m *DataflowPiTRTimeRange) validateStartTs(formats strfmt.Registry) error {
	if swag.IsZero(m.StartTs) { // not required
		return nil
	}

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

	return nil
}

// ContextValidate validates this dataflow pi t r time range based on context it is used
func (m *DataflowPiTRTimeRange) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
	return nil
}

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

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