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

// Billing20201105GetStatementResponse GetStatementResponse is a response for GetStatement endpoint
//
// swagger:model billing_20201105GetStatementResponse
type Billing20201105GetStatementResponse struct {

	// statement is the statement with the specified id.
	Statement *Billing20201105Statement `json:"statement,omitempty"`
}

// Validate validates this billing 20201105 get statement response
func (m *Billing20201105GetStatementResponse) Validate(formats strfmt.Registry) error {
	var res []error

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

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

func (m *Billing20201105GetStatementResponse) validateStatement(formats strfmt.Registry) error {
	if swag.IsZero(m.Statement) { // not required
		return nil
	}

	if m.Statement != nil {
		if err := m.Statement.Validate(formats); err != nil {
			if ve, ok := err.(*errors.Validation); ok {
				return ve.ValidateName("statement")
			} else if ce, ok := err.(*errors.CompositeError); ok {
				return ce.ValidateName("statement")
			}
			return err
		}
	}

	return nil
}

// ContextValidate validate this billing 20201105 get statement response based on the context it is used
func (m *Billing20201105GetStatementResponse) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
	var res []error

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

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

func (m *Billing20201105GetStatementResponse) contextValidateStatement(ctx context.Context, formats strfmt.Registry) error {

	if m.Statement != nil {

		if swag.IsZero(m.Statement) { // not required
			return nil
		}

		if err := m.Statement.ContextValidate(ctx, formats); err != nil {
			if ve, ok := err.(*errors.Validation); ok {
				return ve.ValidateName("statement")
			} else if ce, ok := err.(*errors.CompositeError); ok {
				return ce.ValidateName("statement")
			}
			return err
		}
	}

	return nil
}

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

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