lib/api/sf-gate/sf_gate_models/item_basic.go

227 lines
5.3 KiB
Go

// 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"
)
// ItemBasic item basic
//
// swagger:model ItemBasic
type ItemBasic struct {
// Cost of Goods Sold
Cogs float64 `json:"cogs,omitempty"`
// Line Item Description
Description string `json:"description,omitempty"`
// Taxnexus Record Id Only; not used in POST
ID string `json:"id,omitempty"`
// Source System Parent Foreign Key to Invoice
Invoiceid string `json:"invoiceid,omitempty"`
// UUID Reference the master record that owns this item
Parentfk string `json:"parentfk,omitempty"`
// Product Code
Productcode string `json:"productcode,omitempty"`
// Quantity
// Required: true
Quantity *float64 `json:"quantity"`
// Source System identifier for this record, if any
// Required: true
Ref *string `json:"ref"`
// Sales Regulation Type
Salesregulation string `json:"salesregulation,omitempty"`
// Shipping & Handling and Delivery Fees for this Item
Shippinghandling float64 `json:"shippinghandling,omitempty"`
// Subtotal
Subtotal float64 `json:"subtotal,omitempty"`
// Taxnexus Code
// Required: true
Taxnexuscode *string `json:"taxnexuscode"`
// Unit Price
// Required: true
Unitprice *float64 `json:"unitprice"`
// The Unit of Measure for this item
// Enum: [each month day week hour oz_drywt_flower oz_drywt_leaves oz_fresh gm oz lb]
Units string `json:"units,omitempty"`
}
// Validate validates this item basic
func (m *ItemBasic) Validate(formats strfmt.Registry) error {
var res []error
if err := m.validateQuantity(formats); err != nil {
res = append(res, err)
}
if err := m.validateRef(formats); err != nil {
res = append(res, err)
}
if err := m.validateTaxnexuscode(formats); err != nil {
res = append(res, err)
}
if err := m.validateUnitprice(formats); err != nil {
res = append(res, err)
}
if err := m.validateUnits(formats); err != nil {
res = append(res, err)
}
if len(res) > 0 {
return errors.CompositeValidationError(res...)
}
return nil
}
func (m *ItemBasic) validateQuantity(formats strfmt.Registry) error {
if err := validate.Required("quantity", "body", m.Quantity); err != nil {
return err
}
return nil
}
func (m *ItemBasic) validateRef(formats strfmt.Registry) error {
if err := validate.Required("ref", "body", m.Ref); err != nil {
return err
}
return nil
}
func (m *ItemBasic) validateTaxnexuscode(formats strfmt.Registry) error {
if err := validate.Required("taxnexuscode", "body", m.Taxnexuscode); err != nil {
return err
}
return nil
}
func (m *ItemBasic) validateUnitprice(formats strfmt.Registry) error {
if err := validate.Required("unitprice", "body", m.Unitprice); err != nil {
return err
}
return nil
}
var itemBasicTypeUnitsPropEnum []interface{}
func init() {
var res []string
if err := json.Unmarshal([]byte(`["each","month","day","week","hour","oz_drywt_flower","oz_drywt_leaves","oz_fresh","gm","oz","lb"]`), &res); err != nil {
panic(err)
}
for _, v := range res {
itemBasicTypeUnitsPropEnum = append(itemBasicTypeUnitsPropEnum, v)
}
}
const (
// ItemBasicUnitsEach captures enum value "each"
ItemBasicUnitsEach string = "each"
// ItemBasicUnitsMonth captures enum value "month"
ItemBasicUnitsMonth string = "month"
// ItemBasicUnitsDay captures enum value "day"
ItemBasicUnitsDay string = "day"
// ItemBasicUnitsWeek captures enum value "week"
ItemBasicUnitsWeek string = "week"
// ItemBasicUnitsHour captures enum value "hour"
ItemBasicUnitsHour string = "hour"
// ItemBasicUnitsOzDrywtFlower captures enum value "oz_drywt_flower"
ItemBasicUnitsOzDrywtFlower string = "oz_drywt_flower"
// ItemBasicUnitsOzDrywtLeaves captures enum value "oz_drywt_leaves"
ItemBasicUnitsOzDrywtLeaves string = "oz_drywt_leaves"
// ItemBasicUnitsOzFresh captures enum value "oz_fresh"
ItemBasicUnitsOzFresh string = "oz_fresh"
// ItemBasicUnitsGm captures enum value "gm"
ItemBasicUnitsGm string = "gm"
// ItemBasicUnitsOz captures enum value "oz"
ItemBasicUnitsOz string = "oz"
// ItemBasicUnitsLb captures enum value "lb"
ItemBasicUnitsLb string = "lb"
)
// prop value enum
func (m *ItemBasic) validateUnitsEnum(path, location string, value string) error {
if err := validate.EnumCase(path, location, value, itemBasicTypeUnitsPropEnum, true); err != nil {
return err
}
return nil
}
func (m *ItemBasic) validateUnits(formats strfmt.Registry) error {
if swag.IsZero(m.Units) { // not required
return nil
}
// value enum
if err := m.validateUnitsEnum("units", "body", m.Units); err != nil {
return err
}
return nil
}
// MarshalBinary interface implementation
func (m *ItemBasic) MarshalBinary() ([]byte, error) {
if m == nil {
return nil, nil
}
return swag.WriteJSON(m)
}
// UnmarshalBinary interface implementation
func (m *ItemBasic) UnmarshalBinary(b []byte) error {
var res ItemBasic
if err := swag.ReadJSON(b, &res); err != nil {
return err
}
*m = res
return nil
}