lib/api/sfgate/sfgate_models/contract.go

242 lines
5.8 KiB
Go
Raw Normal View History

2023-09-23 17:19:44 +00:00
// Code generated by go-swagger; DO NOT EDIT.
// (c) 2012-2023 by Vernon Keenan
// All rights reserved worldwide.
// Proprietary product; unlicensed use is not allowed
package sfgate_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
//
// swagger:model Contract
type Contract struct {
// Account
AccountID *string `json:"AccountID,omitempty"`
// Activated By
ActivatedByID *string `json:"ActivatedByID,omitempty"`
// Activated Date
ActivatedDate *string `json:"ActivatedDate,omitempty"`
// Billing Address
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"`
// End User
EndUserID *string `json:"EndUserID,omitempty"`
// Hourly Rate
HourlyRate *float64 `json:"HourlyRate,omitempty"`
// Telnexus Record Id
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"`
// Shipping Address
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
}