lib/api/crm/crm_models/contract.go

242 lines
5.8 KiB
Go
Raw Permalink Normal View History

2022-05-28 19:45:41 +00:00
// Code generated by go-swagger; DO NOT EDIT.
// (c) 2012-2020 by Taxnexus, Inc.
// All rights reserved worldwide.
// Proprietary product; unlicensed use is not allowed
package crm_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"
"github.com/go-openapi/errors"
"github.com/go-openapi/strfmt"
"github.com/go-openapi/swag"
)
// Contract contract
//
2023-04-06 01:28:58 +00:00
// swagger:model contract
2022-05-28 19:45:41 +00:00
type Contract struct {
// Account
AccountID string `json:"AccountID,omitempty"`
// Activated By
ActivatedByID string `json:"ActivatedByID,omitempty"`
// Activated Date
ActivatedDate string `json:"ActivatedDate,omitempty"`
2023-04-06 01:28:58 +00:00
// billing address
2022-05-28 19:45:41 +00:00
BillingAddress *Address `json:"BillingAddress,omitempty"`
// Billing Contact
BillingContactID string `json:"BillingContactID,omitempty"`
// Company Signed Date
CompanySignedDate string `json:"CompanySignedDate,omitempty"`
// Company Signed By
CompanySignedID string `json:"CompanySignedID,omitempty"`
// Contract Number
ContractNumber string `json:"ContractNumber,omitempty"`
// Contract Term (months)
ContractTerm float64 `json:"ContractTerm,omitempty"`
// Created By User ID
CreatedByID string `json:"CreatedByID,omitempty"`
// Created Date
CreatedDate string `json:"CreatedDate,omitempty"`
// Customer Signed Date
CustomerSignedDate string `json:"CustomerSignedDate,omitempty"`
// Customer Signed By
CustomerSignedID string `json:"CustomerSignedID,omitempty"`
// Customer Signed Title
CustomerSignedTitle string `json:"CustomerSignedTitle,omitempty"`
// End User
DefaultEndUserID string `json:"DefaultEndUserID,omitempty"`
// Description
Description string `json:"Description,omitempty"`
// Contract End Date
EndDate string `json:"EndDate,omitempty"`
2023-04-06 01:28:58 +00:00
// End User
EndUserID string `json:"EndUserID,omitempty"`
2022-05-28 19:45:41 +00:00
// Hourly Rate
HourlyRate float64 `json:"HourlyRate,omitempty"`
2023-04-06 01:28:58 +00:00
// Telnexus Record Id
2022-05-28 19:45:41 +00:00
ID string `json:"ID,omitempty"`
// Last Modified By User ID
LastModifiedByID string `json:"LastModifiedByID,omitempty"`
// Last Modified Date
LastModifiedDate string `json:"LastModifiedDate,omitempty"`
// Contract Name
Name string `json:"Name,omitempty"`
// Payment Method
PaymentMethodID string `json:"PaymentMethodID,omitempty"`
// Payment Terms
PaymentTerms string `json:"PaymentTerms,omitempty"`
// Perpetual Agreement?
Perpetual bool `json:"Perpetual,omitempty"`
2023-04-06 01:28:58 +00:00
// shipping address
2022-05-28 19:45:41 +00:00
ShippingAddress *Address `json:"ShippingAddress,omitempty"`
// Shipping Contact
ShippingContactID string `json:"ShippingContactID,omitempty"`
// Contract Start Date
StartDate string `json:"StartDate,omitempty"`
// Status
Status string `json:"Status,omitempty"`
// Tenant Identifier
TenantID string `json:"TenantID,omitempty"`
}
// Validate validates this contract
func (m *Contract) Validate(formats strfmt.Registry) error {
var res []error
if err := m.validateBillingAddress(formats); err != nil {
res = append(res, err)
}
if err := m.validateShippingAddress(formats); err != nil {
res = append(res, err)
}
if len(res) > 0 {
return errors.CompositeValidationError(res...)
}
return nil
}
func (m *Contract) validateBillingAddress(formats strfmt.Registry) error {
if swag.IsZero(m.BillingAddress) { // not required
return nil
}
if m.BillingAddress != nil {
if err := m.BillingAddress.Validate(formats); err != nil {
if ve, ok := err.(*errors.Validation); ok {
return ve.ValidateName("BillingAddress")
} else if ce, ok := err.(*errors.CompositeError); ok {
return ce.ValidateName("BillingAddress")
}
return err
}
}
return nil
}
func (m *Contract) validateShippingAddress(formats strfmt.Registry) error {
if swag.IsZero(m.ShippingAddress) { // not required
return nil
}
if m.ShippingAddress != nil {
if err := m.ShippingAddress.Validate(formats); err != nil {
if ve, ok := err.(*errors.Validation); ok {
return ve.ValidateName("ShippingAddress")
} else if ce, ok := err.(*errors.CompositeError); ok {
return ce.ValidateName("ShippingAddress")
}
return err
}
}
return nil
}
// ContextValidate validate this contract based on the context it is used
func (m *Contract) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
var res []error
if err := m.contextValidateBillingAddress(ctx, formats); err != nil {
res = append(res, err)
}
if err := m.contextValidateShippingAddress(ctx, formats); err != nil {
res = append(res, err)
}
if len(res) > 0 {
return errors.CompositeValidationError(res...)
}
return nil
}
func (m *Contract) contextValidateBillingAddress(ctx context.Context, formats strfmt.Registry) error {
if m.BillingAddress != nil {
if err := m.BillingAddress.ContextValidate(ctx, formats); err != nil {
if ve, ok := err.(*errors.Validation); ok {
return ve.ValidateName("BillingAddress")
} else if ce, ok := err.(*errors.CompositeError); ok {
return ce.ValidateName("BillingAddress")
}
return err
}
}
return nil
}
func (m *Contract) contextValidateShippingAddress(ctx context.Context, formats strfmt.Registry) error {
if m.ShippingAddress != nil {
if err := m.ShippingAddress.ContextValidate(ctx, formats); err != nil {
if ve, ok := err.(*errors.Validation); ok {
return ve.ValidateName("ShippingAddress")
} else if ce, ok := err.(*errors.CompositeError); ok {
return ce.ValidateName("ShippingAddress")
}
return err
}
}
return nil
}
// MarshalBinary interface implementation
func (m *Contract) MarshalBinary() ([]byte, error) {
if m == nil {
return nil, nil
}
return swag.WriteJSON(m)
}
// UnmarshalBinary interface implementation
func (m *Contract) UnmarshalBinary(b []byte) error {
var res Contract
if err := swag.ReadJSON(b, &res); err != nil {
return err
}
*m = res
return nil
}