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

// NoRangeThingWithCompositeAttributes no range thing with composite attributes
//
// swagger:model NoRangeThingWithCompositeAttributes
type NoRangeThingWithCompositeAttributes struct {

	// branch
	// Required: true
	Branch *string `json:"branch"`

	// commit
	// Required: true
	Commit *string `json:"commit"`

	// date
	// Required: true
	// Format: date-time
	Date *strfmt.DateTime `json:"date"`

	// name
	// Required: true
	Name *string `json:"name"`

	// version
	Version int64 `json:"version,omitempty"`
}

// Validate validates this no range thing with composite attributes
func (m *NoRangeThingWithCompositeAttributes) Validate(formats strfmt.Registry) error {
	var res []error

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

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

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

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

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

func (m *NoRangeThingWithCompositeAttributes) validateBranch(formats strfmt.Registry) error {

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

	return nil
}

func (m *NoRangeThingWithCompositeAttributes) validateCommit(formats strfmt.Registry) error {

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

	return nil
}

func (m *NoRangeThingWithCompositeAttributes) validateDate(formats strfmt.Registry) error {

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

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

	return nil
}

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

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

	return nil
}

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

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