lib/api/ledger/ledger_models/gl_account.go

180 lines
4.0 KiB
Go
Raw Normal View History

2021-01-08 17:40:28 +00:00
// Code generated by go-swagger; DO NOT EDIT.
2021-01-19 16:58:40 +00:00
// All Code Copyright(c) 2018-2021 by Taxnexus, Inc.
2021-01-08 17:40:28 +00:00
// All rights reserved worldwide.
// Proprietary product; unlicensed use is not allowed
package ledger_models
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command
import (
2021-02-09 16:56:57 +00:00
"context"
2021-01-08 17:40:28 +00:00
"strconv"
"github.com/go-openapi/errors"
"github.com/go-openapi/strfmt"
"github.com/go-openapi/swag"
)
// GlAccount gl account
//
// swagger:model GlAccount
type GlAccount struct {
// Taxnexus Account that owns ths GL account
AccountID string `json:"AccountID,omitempty"`
// Account Level
AccountLevel float64 `json:"AccountLevel,omitempty"`
// Account Name
AccountName string `json:"AccountName,omitempty"`
// Account Sign
AccountSign string `json:"AccountSign,omitempty"`
// Account Type
AccountType string `json:"AccountType,omitempty"`
// The GL Balances associated with this GL account
Balances []*GlBalance `json:"Balances"`
// Created By User ID
CreatedByID string `json:"CreatedByID,omitempty"`
// Created Date
CreatedDate string `json:"CreatedDate,omitempty"`
// Description
Description string `json:"Description,omitempty"`
// Taxnexus Record Id Only; not used in POST
ID string `json:"ID,omitempty"`
// Is Active?
IsActive bool `json:"IsActive,omitempty"`
// Is Bank Account ?
IsBankAccount bool `json:"IsBankAccount,omitempty"`
// Is Summary?
IsSummary bool `json:"IsSummary,omitempty"`
// Last Modified By User ID
LastModifiedByID string `json:"LastModifiedByID,omitempty"`
// Last Modified Date
LastModifiedDate string `json:"LastModifiedDate,omitempty"`
// Display value for GL Account
Name string `json:"Name,omitempty"`
// Parent Foreign Key
ParentFK string `json:"ParentFK,omitempty"`
// Source System identifier for this record, if any
Ref string `json:"Ref,omitempty"`
// Status
Status string `json:"Status,omitempty"`
// Tenant that owns this object instance
TenantID string `json:"TenantID,omitempty"`
// Account Number
AccountNumber float64 `json:"accountNumber,omitempty"`
// Parent GL Account ID
ParentGLAccountID string `json:"parentGLAccountID,omitempty"`
}
// Validate validates this gl account
func (m *GlAccount) Validate(formats strfmt.Registry) error {
var res []error
if err := m.validateBalances(formats); err != nil {
res = append(res, err)
}
if len(res) > 0 {
return errors.CompositeValidationError(res...)
}
return nil
}
func (m *GlAccount) validateBalances(formats strfmt.Registry) error {
if swag.IsZero(m.Balances) { // not required
return nil
}
for i := 0; i < len(m.Balances); i++ {
if swag.IsZero(m.Balances[i]) { // not required
continue
}
if m.Balances[i] != nil {
if err := m.Balances[i].Validate(formats); err != nil {
if ve, ok := err.(*errors.Validation); ok {
return ve.ValidateName("Balances" + "." + strconv.Itoa(i))
}
return err
}
}
}
return nil
}
2021-02-09 16:56:57 +00:00
// ContextValidate validate this gl account based on the context it is used
func (m *GlAccount) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
var res []error
if err := m.contextValidateBalances(ctx, formats); err != nil {
res = append(res, err)
}
if len(res) > 0 {
return errors.CompositeValidationError(res...)
}
return nil
}
func (m *GlAccount) contextValidateBalances(ctx context.Context, formats strfmt.Registry) error {
for i := 0; i < len(m.Balances); i++ {
if m.Balances[i] != nil {
if err := m.Balances[i].ContextValidate(ctx, formats); err != nil {
if ve, ok := err.(*errors.Validation); ok {
return ve.ValidateName("Balances" + "." + strconv.Itoa(i))
}
return err
}
}
}
return nil
}
2021-01-08 17:40:28 +00:00
// MarshalBinary interface implementation
func (m *GlAccount) MarshalBinary() ([]byte, error) {
if m == nil {
return nil, nil
}
return swag.WriteJSON(m)
}
// UnmarshalBinary interface implementation
func (m *GlAccount) UnmarshalBinary(b []byte) error {
var res GlAccount
if err := swag.ReadJSON(b, &res); err != nil {
return err
}
*m = res
return nil
}