141 lines
3.0 KiB
Go
141 lines
3.0 KiB
Go
// 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 regs_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"
|
|
"strconv"
|
|
|
|
"github.com/go-openapi/errors"
|
|
"github.com/go-openapi/strfmt"
|
|
"github.com/go-openapi/swag"
|
|
)
|
|
|
|
// RatingEngine rating engine
|
|
//
|
|
// swagger:model RatingEngine
|
|
type RatingEngine struct {
|
|
|
|
// Created By User ID
|
|
CreatedByID string `json:"CreatedByID,omitempty"`
|
|
|
|
// Created Date
|
|
CreatedDate string `json:"CreatedDate,omitempty"`
|
|
|
|
// Description
|
|
Description string `json:"Description,omitempty"`
|
|
|
|
// Taxnexus Rating Engine Record Id
|
|
ID string `json:"ID,omitempty"`
|
|
|
|
// Ingest Method
|
|
IngestMethod string `json:"IngestMethod,omitempty"`
|
|
|
|
// Last Modified By User ID
|
|
LastModifiedByID string `json:"LastModifiedByID,omitempty"`
|
|
|
|
// Last Modified Date
|
|
LastModifiedDate string `json:"LastModifiedDate,omitempty"`
|
|
|
|
// Rating Engine Name
|
|
Name string `json:"Name,omitempty"`
|
|
|
|
// rules
|
|
Rules []*RatingEngineItem `json:"Rules"`
|
|
}
|
|
|
|
// Validate validates this rating engine
|
|
func (m *RatingEngine) Validate(formats strfmt.Registry) error {
|
|
var res []error
|
|
|
|
if err := m.validateRules(formats); err != nil {
|
|
res = append(res, err)
|
|
}
|
|
|
|
if len(res) > 0 {
|
|
return errors.CompositeValidationError(res...)
|
|
}
|
|
return nil
|
|
}
|
|
|
|
func (m *RatingEngine) validateRules(formats strfmt.Registry) error {
|
|
if swag.IsZero(m.Rules) { // not required
|
|
return nil
|
|
}
|
|
|
|
for i := 0; i < len(m.Rules); i++ {
|
|
if swag.IsZero(m.Rules[i]) { // not required
|
|
continue
|
|
}
|
|
|
|
if m.Rules[i] != nil {
|
|
if err := m.Rules[i].Validate(formats); err != nil {
|
|
if ve, ok := err.(*errors.Validation); ok {
|
|
return ve.ValidateName("Rules" + "." + strconv.Itoa(i))
|
|
}
|
|
return err
|
|
}
|
|
}
|
|
|
|
}
|
|
|
|
return nil
|
|
}
|
|
|
|
// ContextValidate validate this rating engine based on the context it is used
|
|
func (m *RatingEngine) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
|
|
var res []error
|
|
|
|
if err := m.contextValidateRules(ctx, formats); err != nil {
|
|
res = append(res, err)
|
|
}
|
|
|
|
if len(res) > 0 {
|
|
return errors.CompositeValidationError(res...)
|
|
}
|
|
return nil
|
|
}
|
|
|
|
func (m *RatingEngine) contextValidateRules(ctx context.Context, formats strfmt.Registry) error {
|
|
|
|
for i := 0; i < len(m.Rules); i++ {
|
|
|
|
if m.Rules[i] != nil {
|
|
if err := m.Rules[i].ContextValidate(ctx, formats); err != nil {
|
|
if ve, ok := err.(*errors.Validation); ok {
|
|
return ve.ValidateName("Rules" + "." + strconv.Itoa(i))
|
|
}
|
|
return err
|
|
}
|
|
}
|
|
|
|
}
|
|
|
|
return nil
|
|
}
|
|
|
|
// MarshalBinary interface implementation
|
|
func (m *RatingEngine) MarshalBinary() ([]byte, error) {
|
|
if m == nil {
|
|
return nil, nil
|
|
}
|
|
return swag.WriteJSON(m)
|
|
}
|
|
|
|
// UnmarshalBinary interface implementation
|
|
func (m *RatingEngine) UnmarshalBinary(b []byte) error {
|
|
var res RatingEngine
|
|
if err := swag.ReadJSON(b, &res); err != nil {
|
|
return err
|
|
}
|
|
*m = res
|
|
return nil
|
|
}
|