// 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 (
	"encoding/json"

	"github.com/go-openapi/errors"
	"github.com/go-openapi/strfmt"
	"github.com/go-openapi/swag"
	"github.com/go-openapi/validate"
	"github.com/lib/pq"
)

// BillRunList bill run list
//
// swagger:model BillRunList
type BillRunList struct {

	// amount invoiced
	AmountInvoiced float64 `json:"AmountInvoiced,omitempty"`

	// creation timestamp
	// Format: date-time
	CreationTimestamp strfmt.DateTime `json:"CreationTimestamp,omitempty"`

	// ID
	// Format: uuid
	ID strfmt.UUID `json:"ID,omitempty"`

	// invoices count
	InvoicesCount int64 `json:"InvoicesCount,omitempty"`

	// invoices error count
	InvoicesErrorCount int64 `json:"InvoicesErrorCount,omitempty"`

	// invoices error list
	InvoicesErrorList pq.StringArray `json:"InvoicesErrorList,omitempty" gorm:"type:text[]"`

	// invoices processed count
	InvoicesProcessedCount int64 `json:"InvoicesProcessedCount,omitempty"`

	// organizations involved
	OrganizationsInvolved pq.StringArray `json:"OrganizationsInvolved,omitempty" gorm:"type:text[]"`

	// status
	// Enum: [ERROR FINISHED PROCESSING QUEUED]
	Status *string `json:"Status,omitempty"`
}

// Validate validates this bill run list
func (m *BillRunList) Validate(formats strfmt.Registry) error {
	var res []error

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

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

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

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

func (m *BillRunList) validateCreationTimestamp(formats strfmt.Registry) error {

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

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

	return nil
}

func (m *BillRunList) validateID(formats strfmt.Registry) error {

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

	if err := validate.FormatOf("ID", "body", "uuid", m.ID.String(), formats); err != nil {
		return err
	}

	return nil
}

var billRunListTypeStatusPropEnum []interface{}

func init() {
	var res []string
	if err := json.Unmarshal([]byte(`["ERROR","FINISHED","PROCESSING","QUEUED"]`), &res); err != nil {
		panic(err)
	}
	for _, v := range res {
		billRunListTypeStatusPropEnum = append(billRunListTypeStatusPropEnum, v)
	}
}

const (

	// BillRunListStatusERROR captures enum value "ERROR"
	BillRunListStatusERROR string = "ERROR"

	// BillRunListStatusFINISHED captures enum value "FINISHED"
	BillRunListStatusFINISHED string = "FINISHED"

	// BillRunListStatusPROCESSING captures enum value "PROCESSING"
	BillRunListStatusPROCESSING string = "PROCESSING"

	// BillRunListStatusQUEUED captures enum value "QUEUED"
	BillRunListStatusQUEUED string = "QUEUED"
)

// prop value enum
func (m *BillRunList) validateStatusEnum(path, location string, value string) error {
	if err := validate.EnumCase(path, location, value, billRunListTypeStatusPropEnum, true); err != nil {
		return err
	}
	return nil
}

func (m *BillRunList) validateStatus(formats strfmt.Registry) error {

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

	// value enum
	if err := m.validateStatusEnum("Status", "body", *m.Status); err != nil {
		return err
	}

	return nil
}

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

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