// 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 sf_gate_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"`

	// formatted
	Formatted *IngestFormatted `json:"formatted,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"`

	// License
	Metrclicense string `json:"metrclicense,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"`

	// Parent Foreign Key
	Parentfk string `json:"parentfk,omitempty"`

	// Period ID
	Periodid string `json:"periodid,omitempty"`

	// PO Count
	Pocount int64 `json:"pocount,omitempty"`

	// Post Failure Reason
	Postfailurereason string `json:"postfailurereason,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
	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"`

	// Tax Transaction Count
	Taxtransactioncount int64 `json:"taxtransactioncount,omitempty"`

	// Template
	Templateid string `json:"templateid,omitempty"`

	// tenant identifier
	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.validateFormatted(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.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
}

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

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

	if m.Formatted != nil {
		if err := m.Formatted.Validate(formats); err != nil {
			if ve, ok := err.(*errors.Validation); ok {
				return ve.ValidateName("formatted")
			}
			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 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
}

// IngestFormatted Numeric and Date Values Pre-formatted as Text
//
// swagger:model IngestFormatted
type IngestFormatted struct {

	// amount
	Amount string `json:"amount,omitempty"`

	// ingestdate
	Ingestdate string `json:"ingestdate,omitempty"`

	// invoicecount
	Invoicecount string `json:"invoicecount,omitempty"`

	// pocount
	Pocount string `json:"pocount,omitempty"`

	// revenuebase
	Revenuebase string `json:"revenuebase,omitempty"`

	// revenuenottaxable
	Revenuenottaxable string `json:"revenuenottaxable,omitempty"`

	// unitbase
	Unitbase string `json:"unitbase,omitempty"`
}

// Validate validates this ingest formatted
func (m *IngestFormatted) Validate(formats strfmt.Registry) error {
	return nil
}

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

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