lib/api/sfgate/sfgate_models/factor.go

148 lines
3.5 KiB
Go
Raw Permalink 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"
"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
//
2023-10-26 15:37:13 +00:00
// swagger:model factor
2023-09-23 17:19:44 +00:00
type Factor struct {
// Created By User ID
CreatedByID *string `json:"CreatedByID,omitempty"`
// Created Date
CreatedDate *string `json:"CreatedDate,omitempty"`
// Topic Description
Description *string `json:"Description,omitempty"`
// 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"`
// Factor Name
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
Slug *string `json:"Slug,omitempty"`
// The ID of the Topic that owns this Factor
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
}