lib/api/research/research_models/topic.go

148 lines
3.3 KiB
Go
Raw Permalink Normal View History

2022-09-07 00:16:25 +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 research_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"
)
// Topic A research topic that collects data
//
// swagger:model Topic
type Topic struct {
// Created By User ID
CreatedByID string `json:"CreatedByID,omitempty"`
// Created Date
CreatedDate string `json:"CreatedDate,omitempty"`
// Topic Description
Description string `json:"Description,omitempty"`
// The list of Factors used to analyze this industry
Factors []*Factor `json:"Factors"`
2023-03-28 17:47:34 +00:00
// Record Id
2022-09-07 00:16:25 +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"`
// Topic Name
Name string `json:"Name,omitempty"`
// The ID of the Parent Topic
ParentTopicID string `json:"ParentTopicID,omitempty"`
2023-03-28 17:47:34 +00:00
// The CMS Slug for this Topic
Slug string `json:"Slug,omitempty"`
2022-09-07 00:16:25 +00:00
}
// Validate validates this topic
func (m *Topic) Validate(formats strfmt.Registry) error {
var res []error
if err := m.validateFactors(formats); err != nil {
res = append(res, err)
}
if len(res) > 0 {
return errors.CompositeValidationError(res...)
}
return nil
}
func (m *Topic) validateFactors(formats strfmt.Registry) error {
if swag.IsZero(m.Factors) { // not required
return nil
}
for i := 0; i < len(m.Factors); i++ {
if swag.IsZero(m.Factors[i]) { // not required
continue
}
if m.Factors[i] != nil {
if err := m.Factors[i].Validate(formats); err != nil {
if ve, ok := err.(*errors.Validation); ok {
return ve.ValidateName("Factors" + "." + strconv.Itoa(i))
} else if ce, ok := err.(*errors.CompositeError); ok {
return ce.ValidateName("Factors" + "." + strconv.Itoa(i))
}
return err
}
}
}
return nil
}
// ContextValidate validate this topic based on the context it is used
func (m *Topic) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
var res []error
if err := m.contextValidateFactors(ctx, formats); err != nil {
res = append(res, err)
}
if len(res) > 0 {
return errors.CompositeValidationError(res...)
}
return nil
}
func (m *Topic) contextValidateFactors(ctx context.Context, formats strfmt.Registry) error {
for i := 0; i < len(m.Factors); i++ {
if m.Factors[i] != nil {
if err := m.Factors[i].ContextValidate(ctx, formats); err != nil {
if ve, ok := err.(*errors.Validation); ok {
return ve.ValidateName("Factors" + "." + strconv.Itoa(i))
} else if ce, ok := err.(*errors.CompositeError); ok {
return ce.ValidateName("Factors" + "." + strconv.Itoa(i))
}
return err
}
}
}
return nil
}
// MarshalBinary interface implementation
func (m *Topic) MarshalBinary() ([]byte, error) {
if m == nil {
return nil, nil
}
return swag.WriteJSON(m)
}
// UnmarshalBinary interface implementation
func (m *Topic) UnmarshalBinary(b []byte) error {
var res Topic
if err := swag.ReadJSON(b, &res); err != nil {
return err
}
*m = res
return nil
}