// Code generated by go-swagger; DO NOT EDIT. // All Code Copyright(c) 2018-2021 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 ( "context" "encoding/json" "strconv" "github.com/go-openapi/errors" "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" "github.com/go-openapi/validate" ) // InvoiceBasic invoice basic // // swagger:model InvoiceBasic type InvoiceBasic struct { // Account Identifier from Source System; ignored in tax calculations Accountid string `json:"accountid,omitempty"` // Invoice Amount; ignored in tax calculation Amount float64 `json:"amount,omitempty"` // Amount Due; ignored in tax calculations Amountdue float64 `json:"amountdue,omitempty"` // coordinate Coordinate *Address `json:"coordinate,omitempty"` // Taxnexus Record Id Only; not used in POST ID string `json:"id,omitempty"` // Invoice Date; should be date only or correct time zone if in time notation Invoicedate string `json:"invoicedate,omitempty"` // Source System Customer-Facing Invoice Number; ignored in tax calculation Invoicenumber string `json:"invoicenumber,omitempty"` // The items associated with this Invoice Items []*ItemBasic `json:"items"` // UUID Reference the master record that owns this item Parentfk string `json:"parentfk,omitempty"` // Source System identifier for this record, if any Ref string `json:"ref,omitempty"` // Sales Regulation Type Salesregulation string `json:"salesregulation,omitempty"` // Status used by for Billing Balances; ignored in tax calculation // Enum: [closed delivered hold issued new posted rated rating_failed rating_ready reissued rendered uncollectable voided] Status string `json:"status,omitempty"` // Subtotal Subtotal float64 `json:"subtotal,omitempty"` // tenant identifier Tenantid string `json:"tenantid,omitempty"` // Invoice Type Type string `json:"type,omitempty"` } // Validate validates this invoice basic func (m *InvoiceBasic) Validate(formats strfmt.Registry) error { var res []error if err := m.validateCoordinate(formats); err != nil { res = append(res, err) } if err := m.validateItems(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 *InvoiceBasic) validateCoordinate(formats strfmt.Registry) error { if swag.IsZero(m.Coordinate) { // not required return nil } if m.Coordinate != nil { if err := m.Coordinate.Validate(formats); err != nil { if ve, ok := err.(*errors.Validation); ok { return ve.ValidateName("coordinate") } return err } } return nil } func (m *InvoiceBasic) validateItems(formats strfmt.Registry) error { if swag.IsZero(m.Items) { // not required return nil } for i := 0; i < len(m.Items); i++ { if swag.IsZero(m.Items[i]) { // not required continue } if m.Items[i] != nil { if err := m.Items[i].Validate(formats); err != nil { if ve, ok := err.(*errors.Validation); ok { return ve.ValidateName("items" + "." + strconv.Itoa(i)) } return err } } } return nil } var invoiceBasicTypeStatusPropEnum []interface{} func init() { var res []string if err := json.Unmarshal([]byte(`["closed","delivered","hold","issued","new","posted","rated","rating_failed","rating_ready","reissued","rendered","uncollectable","voided"]`), &res); err != nil { panic(err) } for _, v := range res { invoiceBasicTypeStatusPropEnum = append(invoiceBasicTypeStatusPropEnum, v) } } const ( // InvoiceBasicStatusClosed captures enum value "closed" InvoiceBasicStatusClosed string = "closed" // InvoiceBasicStatusDelivered captures enum value "delivered" InvoiceBasicStatusDelivered string = "delivered" // InvoiceBasicStatusHold captures enum value "hold" InvoiceBasicStatusHold string = "hold" // InvoiceBasicStatusIssued captures enum value "issued" InvoiceBasicStatusIssued string = "issued" // InvoiceBasicStatusNew captures enum value "new" InvoiceBasicStatusNew string = "new" // InvoiceBasicStatusPosted captures enum value "posted" InvoiceBasicStatusPosted string = "posted" // InvoiceBasicStatusRated captures enum value "rated" InvoiceBasicStatusRated string = "rated" // InvoiceBasicStatusRatingFailed captures enum value "rating_failed" InvoiceBasicStatusRatingFailed string = "rating_failed" // InvoiceBasicStatusRatingReady captures enum value "rating_ready" InvoiceBasicStatusRatingReady string = "rating_ready" // InvoiceBasicStatusReissued captures enum value "reissued" InvoiceBasicStatusReissued string = "reissued" // InvoiceBasicStatusRendered captures enum value "rendered" InvoiceBasicStatusRendered string = "rendered" // InvoiceBasicStatusUncollectable captures enum value "uncollectable" InvoiceBasicStatusUncollectable string = "uncollectable" // InvoiceBasicStatusVoided captures enum value "voided" InvoiceBasicStatusVoided string = "voided" ) // prop value enum func (m *InvoiceBasic) validateStatusEnum(path, location string, value string) error { if err := validate.EnumCase(path, location, value, invoiceBasicTypeStatusPropEnum, true); err != nil { return err } return nil } func (m *InvoiceBasic) 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 } // ContextValidate validate this invoice basic based on the context it is used func (m *InvoiceBasic) ContextValidate(ctx context.Context, formats strfmt.Registry) error { var res []error if err := m.contextValidateCoordinate(ctx, formats); err != nil { res = append(res, err) } if err := m.contextValidateItems(ctx, formats); err != nil { res = append(res, err) } if len(res) > 0 { return errors.CompositeValidationError(res...) } return nil } func (m *InvoiceBasic) contextValidateCoordinate(ctx context.Context, formats strfmt.Registry) error { if m.Coordinate != nil { if err := m.Coordinate.ContextValidate(ctx, formats); err != nil { if ve, ok := err.(*errors.Validation); ok { return ve.ValidateName("coordinate") } return err } } return nil } func (m *InvoiceBasic) contextValidateItems(ctx context.Context, formats strfmt.Registry) error { for i := 0; i < len(m.Items); i++ { if m.Items[i] != nil { if err := m.Items[i].ContextValidate(ctx, formats); err != nil { if ve, ok := err.(*errors.Validation); ok { return ve.ValidateName("items" + "." + strconv.Itoa(i)) } return err } } } return nil } // MarshalBinary interface implementation func (m *InvoiceBasic) MarshalBinary() ([]byte, error) { if m == nil { return nil, nil } return swag.WriteJSON(m) } // UnmarshalBinary interface implementation func (m *InvoiceBasic) UnmarshalBinary(b []byte) error { var res InvoiceBasic if err := swag.ReadJSON(b, &res); err != nil { return err } *m = res return nil }