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

// PullRequestMeta PullRequestMeta PR info if an issue is a PR
//
// swagger:model PullRequestMeta
type PullRequestMeta struct {

	// HTML URL
	HTMLURL string `json:"html_url,omitempty"`

	// has merged
	HasMerged bool `json:"merged,omitempty"`

	// is work in progress
	IsWorkInProgress bool `json:"draft,omitempty"`

	// merged
	// Format: date-time
	Merged strfmt.DateTime `json:"merged_at,omitempty"`
}

// Validate validates this pull request meta
func (m *PullRequestMeta) Validate(formats strfmt.Registry) error {
	var res []error

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

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

func (m *PullRequestMeta) validateMerged(formats strfmt.Registry) error {
	if swag.IsZero(m.Merged) { // not required
		return nil
	}

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

	return nil
}

// ContextValidate validates this pull request meta based on context it is used
func (m *PullRequestMeta) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
	return nil
}

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

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