lib/api/research/research_models/topic.go

148 lines
3.3 KiB
Go
Raw 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
2023-04-15 14:27:18 +00:00
CreatedByID *string `json:"CreatedByID,omitempty"`
2022-09-07 00:16:25 +00:00
// Created Date
2023-04-15 14:27:18 +00:00
CreatedDate *string `json:"CreatedDate,omitempty"`
2022-09-07 00:16:25 +00:00
// Topic Description
2023-04-15 14:27:18 +00:00
Description *string `json:"Description,omitempty"`
2022-09-07 00:16:25 +00:00
// 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
2023-04-15 14:27:18 +00:00
LastModifiedByID *string `json:"LastModifiedByID,omitempty"`
2022-09-07 00:16:25 +00:00
// Last Modified Date
2023-04-15 14:27:18 +00:00
LastModifiedDate *string `json:"LastModifiedDate,omitempty"`
2022-09-07 00:16:25 +00:00
// Topic Name
2023-04-15 14:27:18 +00:00
Name *string `json:"Name,omitempty"`
2022-09-07 00:16:25 +00:00
// The ID of the Parent Topic
2023-04-15 14:27:18 +00:00
ParentTopicID *string `json:"ParentTopicID,omitempty"`
2022-09-07 00:16:25 +00:00
2023-03-28 17:47:34 +00:00
// The CMS Slug for this Topic
2023-04-15 14:27:18 +00:00
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
}