lib/api/sfgate/sfgate_models/factor.go

148 lines
3.5 KiB
Go
Raw Normal View History

// 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 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"
"strconv"
"github.com/go-openapi/errors"
"github.com/go-openapi/strfmt"
"github.com/go-openapi/swag"
)
// Factor A Factor of analysis within a research topic
//
// swagger:model Factor
type Factor struct {
// Created By User ID
2023-04-15 14:27:18 +00:00
CreatedByID *string `json:"CreatedByID,omitempty"`
// Created Date
2023-04-15 14:27:18 +00:00
CreatedDate *string `json:"CreatedDate,omitempty"`
// Topic Description
2023-04-15 14:27:18 +00:00
Description *string `json:"Description,omitempty"`
// Record Id
ID string `json:"ID,omitempty"`
// Last Modified By User ID
2023-04-15 14:27:18 +00:00
LastModifiedByID *string `json:"LastModifiedByID,omitempty"`
// Last Modified Date
2023-04-15 14:27:18 +00:00
LastModifiedDate *string `json:"LastModifiedDate,omitempty"`
// Factor Name
2023-04-15 14:27:18 +00:00
Name *string `json:"Name,omitempty"`
// The list of Observations used to analyze this industry
Observations []*Observation `json:"Observations"`
// The slug of the corresponding page on the CMS
2023-04-15 14:27:18 +00:00
Slug *string `json:"Slug,omitempty"`
// The ID of the Topic that owns this Factor
2023-04-15 14:27:18 +00:00
TopicID *string `json:"TopicID,omitempty"`
}
// Validate validates this factor
func (m *Factor) Validate(formats strfmt.Registry) error {
var res []error
if err := m.validateObservations(formats); err != nil {
res = append(res, err)
}
if len(res) > 0 {
return errors.CompositeValidationError(res...)
}
return nil
}
func (m *Factor) validateObservations(formats strfmt.Registry) error {
if swag.IsZero(m.Observations) { // not required
return nil
}
for i := 0; i < len(m.Observations); i++ {
if swag.IsZero(m.Observations[i]) { // not required
continue
}
if m.Observations[i] != nil {
if err := m.Observations[i].Validate(formats); err != nil {
if ve, ok := err.(*errors.Validation); ok {
return ve.ValidateName("Observations" + "." + strconv.Itoa(i))
} else if ce, ok := err.(*errors.CompositeError); ok {
return ce.ValidateName("Observations" + "." + strconv.Itoa(i))
}
return err
}
}
}
return nil
}
// ContextValidate validate this factor based on the context it is used
func (m *Factor) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
var res []error
if err := m.contextValidateObservations(ctx, formats); err != nil {
res = append(res, err)
}
if len(res) > 0 {
return errors.CompositeValidationError(res...)
}
return nil
}
func (m *Factor) contextValidateObservations(ctx context.Context, formats strfmt.Registry) error {
for i := 0; i < len(m.Observations); i++ {
if m.Observations[i] != nil {
if err := m.Observations[i].ContextValidate(ctx, formats); err != nil {
if ve, ok := err.(*errors.Validation); ok {
return ve.ValidateName("Observations" + "." + strconv.Itoa(i))
} else if ce, ok := err.(*errors.CompositeError); ok {
return ce.ValidateName("Observations" + "." + strconv.Itoa(i))
}
return err
}
}
}
return nil
}
// MarshalBinary interface implementation
func (m *Factor) MarshalBinary() ([]byte, error) {
if m == nil {
return nil, nil
}
return swag.WriteJSON(m)
}
// UnmarshalBinary interface implementation
func (m *Factor) UnmarshalBinary(b []byte) error {
var res Factor
if err := swag.ReadJSON(b, &res); err != nil {
return err
}
*m = res
return nil
}