// Code generated by go-swagger; DO NOT EDIT.

// All Code Copyright(c) 2018-2020 by Taxnexus, Inc.
// All rights reserved worldwide.
// Proprietary product; unlicensed use is not allowed

package devops_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"
)

// Ingest A record of the Ingest of information into Taxnexus
//
// swagger:model Ingest
type Ingest struct {

	// Account ID
	// Required: true
	AccountID *string `json:"AccountID"`

	// Rollup Tax Amount
	Amount float64 `json:"Amount,omitempty"`

	// Backend ID
	BackendID string `json:"BackendID,omitempty"`

	// Company ID
	CompanyID string `json:"CompanyID,omitempty"`

	// Taxnexus User ID
	CreatedByID string `json:"CreatedByID,omitempty"`

	// Date of Job Creation
	CreatedDate string `json:"CreatedDate,omitempty"`

	// Ingest Description
	Description string `json:"Description,omitempty"`

	// End Date
	EndDate string `json:"EndDate,omitempty"`

	// Filename
	Filename string `json:"Filename,omitempty"`

	// Record Id
	ID string `json:"ID,omitempty"`

	// Ingest Date
	IngestDate string `json:"IngestDate,omitempty"`

	// Ingest Failure Reason
	IngestFailureReason string `json:"IngestFailureReason,omitempty"`

	// Ingest Type
	// Enum: [fabric internal suretax taxnexus-api]
	IngestType string `json:"IngestType,omitempty"`

	// Invoice Count
	InvoiceCount int64 `json:"InvoiceCount,omitempty"`

	// Job ID
	JobID string `json:"JobID,omitempty"`

	// Taxnexus User ID
	LastModifiedByID string `json:"LastModifiedByID,omitempty"`

	// Last Modified Date
	LastModifiedDate string `json:"LastModifiedDate,omitempty"`

	// metrc last modified end
	MetrcLastModifiedEnd string `json:"MetrcLastModifiedEnd,omitempty"`

	// metrc last modified start
	MetrcLastModifiedStart string `json:"MetrcLastModifiedStart,omitempty"`

	// License
	MetrcLicense string `json:"MetrcLicense,omitempty"`

	// metrc salesreceipt ID
	MetrcSalesreceiptID int64 `json:"MetrcSalesreceiptID,omitempty"`

	// State Code
	MetrcState string `json:"MetrcState,omitempty"`

	// Ingest Object Type
	// Required: true
	// Enum: [account cash-receipt contact invoice order po quote]
	ObjectType *string `json:"ObjectType"`

	// PO Count
	POCount int64 `json:"POCount,omitempty"`

	// Parent Foreign Key
	ParentFK string `json:"ParentFK,omitempty"`

	// Period ID
	PeriodID string `json:"PeriodID,omitempty"`

	// Post Failure Reason
	PostFalureReason string `json:"PostFalureReason,omitempty"`

	// Rating Engine ID
	RatingEngineID string `json:"RatingEngineID,omitempty"`

	// Source System Reference
	Ref string `json:"Ref,omitempty"`

	// Rollup Revenue Base
	RevenueBase float64 `json:"RevenueBase,omitempty"`

	// Rollup Revenue Net
	RevenueNet float64 `json:"RevenueNet,omitempty"`

	// Rollup Revenue Not Taxable
	RevenueNotTaxable float64 `json:"RevenueNotTaxable,omitempty"`

	// The Saga ID used to link log entries and transactions
	SagaID string `json:"SagaID,omitempty"`

	// The type of Saga transaction being performed
	SagaType string `json:"SagaType,omitempty"`

	// The source system that generated this job
	// Enum: [api fabric taxnexus telnexus]
	Source string `json:"Source,omitempty"`

	// Start Date
	StartDate string `json:"StartDate,omitempty"`

	// Ingest Status
	// Enum: [failed_accounting failed_existing failed_glpost failed_invoice failed_po ingested new posted queued rated rejected]
	Status string `json:"Status,omitempty"`

	// Rollup Tax
	Tax float64 `json:"Tax,omitempty"`

	// Rollup Tax On Tax
	TaxOnTax float64 `json:"TaxOnTax,omitempty"`

	// Tax Transaction Count
	TaxTransactionCount int64 `json:"TaxTransactionCount,omitempty"`

	// Template
	TemplateID string `json:"TemplateID,omitempty"`

	// ID of the Tenant that owns this Object Instance
	TenantID string `json:"TenantID,omitempty"`

	// Rollup Unit Base
	UnitBase int64 `json:"UnitBase,omitempty"`
}

// Validate validates this ingest
func (m *Ingest) Validate(formats strfmt.Registry) error {
	var res []error

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

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

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

	if err := m.validateSource(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 *Ingest) validateAccountID(formats strfmt.Registry) error {

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

	return nil
}

var ingestTypeIngestTypePropEnum []interface{}

func init() {
	var res []string
	if err := json.Unmarshal([]byte(`["fabric","internal","suretax","taxnexus-api"]`), &res); err != nil {
		panic(err)
	}
	for _, v := range res {
		ingestTypeIngestTypePropEnum = append(ingestTypeIngestTypePropEnum, v)
	}
}

const (

	// IngestIngestTypeFabric captures enum value "fabric"
	IngestIngestTypeFabric string = "fabric"

	// IngestIngestTypeInternal captures enum value "internal"
	IngestIngestTypeInternal string = "internal"

	// IngestIngestTypeSuretax captures enum value "suretax"
	IngestIngestTypeSuretax string = "suretax"

	// IngestIngestTypeTaxnexusAPI captures enum value "taxnexus-api"
	IngestIngestTypeTaxnexusAPI string = "taxnexus-api"
)

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

func (m *Ingest) validateIngestType(formats strfmt.Registry) error {

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

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

	return nil
}

var ingestTypeObjectTypePropEnum []interface{}

func init() {
	var res []string
	if err := json.Unmarshal([]byte(`["account","cash-receipt","contact","invoice","order","po","quote"]`), &res); err != nil {
		panic(err)
	}
	for _, v := range res {
		ingestTypeObjectTypePropEnum = append(ingestTypeObjectTypePropEnum, v)
	}
}

const (

	// IngestObjectTypeAccount captures enum value "account"
	IngestObjectTypeAccount string = "account"

	// IngestObjectTypeCashReceipt captures enum value "cash-receipt"
	IngestObjectTypeCashReceipt string = "cash-receipt"

	// IngestObjectTypeContact captures enum value "contact"
	IngestObjectTypeContact string = "contact"

	// IngestObjectTypeInvoice captures enum value "invoice"
	IngestObjectTypeInvoice string = "invoice"

	// IngestObjectTypeOrder captures enum value "order"
	IngestObjectTypeOrder string = "order"

	// IngestObjectTypePo captures enum value "po"
	IngestObjectTypePo string = "po"

	// IngestObjectTypeQuote captures enum value "quote"
	IngestObjectTypeQuote string = "quote"
)

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

func (m *Ingest) validateObjectType(formats strfmt.Registry) error {

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

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

	return nil
}

var ingestTypeSourcePropEnum []interface{}

func init() {
	var res []string
	if err := json.Unmarshal([]byte(`["api","fabric","taxnexus","telnexus"]`), &res); err != nil {
		panic(err)
	}
	for _, v := range res {
		ingestTypeSourcePropEnum = append(ingestTypeSourcePropEnum, v)
	}
}

const (

	// IngestSourceAPI captures enum value "api"
	IngestSourceAPI string = "api"

	// IngestSourceFabric captures enum value "fabric"
	IngestSourceFabric string = "fabric"

	// IngestSourceTaxnexus captures enum value "taxnexus"
	IngestSourceTaxnexus string = "taxnexus"

	// IngestSourceTelnexus captures enum value "telnexus"
	IngestSourceTelnexus string = "telnexus"
)

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

func (m *Ingest) validateSource(formats strfmt.Registry) error {

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

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

	return nil
}

var ingestTypeStatusPropEnum []interface{}

func init() {
	var res []string
	if err := json.Unmarshal([]byte(`["failed_accounting","failed_existing","failed_glpost","failed_invoice","failed_po","ingested","new","posted","queued","rated","rejected"]`), &res); err != nil {
		panic(err)
	}
	for _, v := range res {
		ingestTypeStatusPropEnum = append(ingestTypeStatusPropEnum, v)
	}
}

const (

	// IngestStatusFailedAccounting captures enum value "failed_accounting"
	IngestStatusFailedAccounting string = "failed_accounting"

	// IngestStatusFailedExisting captures enum value "failed_existing"
	IngestStatusFailedExisting string = "failed_existing"

	// IngestStatusFailedGlpost captures enum value "failed_glpost"
	IngestStatusFailedGlpost string = "failed_glpost"

	// IngestStatusFailedInvoice captures enum value "failed_invoice"
	IngestStatusFailedInvoice string = "failed_invoice"

	// IngestStatusFailedPo captures enum value "failed_po"
	IngestStatusFailedPo string = "failed_po"

	// IngestStatusIngested captures enum value "ingested"
	IngestStatusIngested string = "ingested"

	// IngestStatusNew captures enum value "new"
	IngestStatusNew string = "new"

	// IngestStatusPosted captures enum value "posted"
	IngestStatusPosted string = "posted"

	// IngestStatusQueued captures enum value "queued"
	IngestStatusQueued string = "queued"

	// IngestStatusRated captures enum value "rated"
	IngestStatusRated string = "rated"

	// IngestStatusRejected captures enum value "rejected"
	IngestStatusRejected string = "rejected"
)

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

func (m *Ingest) 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 *Ingest) MarshalBinary() ([]byte, error) {
	if m == nil {
		return nil, nil
	}
	return swag.WriteJSON(m)
}

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