mirror of https://github.com/vernonkeenan/lib
427 lines
11 KiB
Go
427 lines
11 KiB
Go
// 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
|
|
|
|
import (
|
|
"context"
|
|
"encoding/json"
|
|
stderrors "errors"
|
|
"strconv"
|
|
|
|
"github.com/go-openapi/errors"
|
|
"github.com/go-openapi/strfmt"
|
|
"github.com/go-openapi/swag/jsonutils"
|
|
"github.com/go-openapi/swag/typeutils"
|
|
"github.com/go-openapi/validate"
|
|
)
|
|
|
|
// PortfolioEnrichmentRunObservation One Research-assembled launch, rebrand, retirement, or stale-offering observation bound to stable run or authoritative identity
|
|
//
|
|
// swagger:model PortfolioEnrichmentRunObservation
|
|
type PortfolioEnrichmentRunObservation struct {
|
|
|
|
// candidate ID
|
|
// Format: uuid
|
|
CandidateID strfmt.UUID `json:"CandidateID,omitempty"`
|
|
|
|
// ID
|
|
// Required: true
|
|
// Format: uuid
|
|
ID *strfmt.UUID `json:"ID"`
|
|
|
|
// kind
|
|
// Required: true
|
|
// Enum: ["launch","rebrand","retirement","stale"]
|
|
Kind *string `json:"Kind"`
|
|
|
|
// observed date
|
|
// Required: true
|
|
// Format: date-time
|
|
ObservedDate *strfmt.DateTime `json:"ObservedDate"`
|
|
|
|
// sources
|
|
// Required: true
|
|
// Max Items: 12
|
|
// Min Items: 1
|
|
Sources []*PortfolioEnrichmentSource `json:"Sources"`
|
|
|
|
// subject entity type
|
|
// Required: true
|
|
// Enum: ["company_product","company_service"]
|
|
SubjectEntityType *string `json:"SubjectEntityType"`
|
|
|
|
// subject name
|
|
// Required: true
|
|
// Max Length: 255
|
|
// Min Length: 1
|
|
SubjectName *string `json:"SubjectName"`
|
|
|
|
// summary
|
|
// Required: true
|
|
// Max Length: 2000
|
|
// Min Length: 1
|
|
Summary *string `json:"Summary"`
|
|
|
|
// target base version
|
|
// Format: date-time
|
|
TargetBaseVersion strfmt.DateTime `json:"TargetBaseVersion,omitempty"`
|
|
|
|
// target ID
|
|
// Max Length: 64
|
|
// Min Length: 1
|
|
// Pattern: ^[A-Za-z0-9_-]+$
|
|
TargetID string `json:"TargetID,omitempty"`
|
|
}
|
|
|
|
// Validate validates this portfolio enrichment run observation
|
|
func (m *PortfolioEnrichmentRunObservation) Validate(formats strfmt.Registry) error {
|
|
var res []error
|
|
|
|
if err := m.validateCandidateID(formats); err != nil {
|
|
res = append(res, err)
|
|
}
|
|
|
|
if err := m.validateID(formats); err != nil {
|
|
res = append(res, err)
|
|
}
|
|
|
|
if err := m.validateKind(formats); err != nil {
|
|
res = append(res, err)
|
|
}
|
|
|
|
if err := m.validateObservedDate(formats); err != nil {
|
|
res = append(res, err)
|
|
}
|
|
|
|
if err := m.validateSources(formats); err != nil {
|
|
res = append(res, err)
|
|
}
|
|
|
|
if err := m.validateSubjectEntityType(formats); err != nil {
|
|
res = append(res, err)
|
|
}
|
|
|
|
if err := m.validateSubjectName(formats); err != nil {
|
|
res = append(res, err)
|
|
}
|
|
|
|
if err := m.validateSummary(formats); err != nil {
|
|
res = append(res, err)
|
|
}
|
|
|
|
if err := m.validateTargetBaseVersion(formats); err != nil {
|
|
res = append(res, err)
|
|
}
|
|
|
|
if err := m.validateTargetID(formats); err != nil {
|
|
res = append(res, err)
|
|
}
|
|
|
|
if len(res) > 0 {
|
|
return errors.CompositeValidationError(res...)
|
|
}
|
|
return nil
|
|
}
|
|
|
|
func (m *PortfolioEnrichmentRunObservation) validateCandidateID(formats strfmt.Registry) error {
|
|
if typeutils.IsZero(m.CandidateID) { // not required
|
|
return nil
|
|
}
|
|
|
|
if err := validate.FormatOf("CandidateID", "body", "uuid", m.CandidateID.String(), formats); err != nil {
|
|
return err
|
|
}
|
|
|
|
return nil
|
|
}
|
|
|
|
func (m *PortfolioEnrichmentRunObservation) validateID(formats strfmt.Registry) error {
|
|
|
|
if err := validate.Required("ID", "body", m.ID); err != nil {
|
|
return err
|
|
}
|
|
|
|
if err := validate.FormatOf("ID", "body", "uuid", m.ID.String(), formats); err != nil {
|
|
return err
|
|
}
|
|
|
|
return nil
|
|
}
|
|
|
|
var portfolioEnrichmentRunObservationTypeKindPropEnum []any
|
|
|
|
func init() {
|
|
var res []string
|
|
if err := json.Unmarshal([]byte(`["launch","rebrand","retirement","stale"]`), &res); err != nil {
|
|
panic(err)
|
|
}
|
|
for _, v := range res {
|
|
portfolioEnrichmentRunObservationTypeKindPropEnum = append(portfolioEnrichmentRunObservationTypeKindPropEnum, v)
|
|
}
|
|
}
|
|
|
|
const (
|
|
|
|
// PortfolioEnrichmentRunObservationKindLaunch captures enum value "launch"
|
|
PortfolioEnrichmentRunObservationKindLaunch string = "launch"
|
|
|
|
// PortfolioEnrichmentRunObservationKindRebrand captures enum value "rebrand"
|
|
PortfolioEnrichmentRunObservationKindRebrand string = "rebrand"
|
|
|
|
// PortfolioEnrichmentRunObservationKindRetirement captures enum value "retirement"
|
|
PortfolioEnrichmentRunObservationKindRetirement string = "retirement"
|
|
|
|
// PortfolioEnrichmentRunObservationKindStale captures enum value "stale"
|
|
PortfolioEnrichmentRunObservationKindStale string = "stale"
|
|
)
|
|
|
|
// prop value enum
|
|
func (m *PortfolioEnrichmentRunObservation) validateKindEnum(path, location string, value string) error {
|
|
if err := validate.EnumCase(path, location, value, portfolioEnrichmentRunObservationTypeKindPropEnum, true); err != nil {
|
|
return err
|
|
}
|
|
return nil
|
|
}
|
|
|
|
func (m *PortfolioEnrichmentRunObservation) validateKind(formats strfmt.Registry) error {
|
|
|
|
if err := validate.Required("Kind", "body", m.Kind); err != nil {
|
|
return err
|
|
}
|
|
|
|
// value enum
|
|
if err := m.validateKindEnum("Kind", "body", *m.Kind); err != nil {
|
|
return err
|
|
}
|
|
|
|
return nil
|
|
}
|
|
|
|
func (m *PortfolioEnrichmentRunObservation) validateObservedDate(formats strfmt.Registry) error {
|
|
|
|
if err := validate.Required("ObservedDate", "body", m.ObservedDate); err != nil {
|
|
return err
|
|
}
|
|
|
|
if err := validate.FormatOf("ObservedDate", "body", "date-time", m.ObservedDate.String(), formats); err != nil {
|
|
return err
|
|
}
|
|
|
|
return nil
|
|
}
|
|
|
|
func (m *PortfolioEnrichmentRunObservation) validateSources(formats strfmt.Registry) error {
|
|
|
|
if err := validate.Required("Sources", "body", m.Sources); err != nil {
|
|
return err
|
|
}
|
|
|
|
iSourcesSize := int64(len(m.Sources))
|
|
|
|
if err := validate.MinItems("Sources", "body", iSourcesSize, 1); err != nil {
|
|
return err
|
|
}
|
|
|
|
if err := validate.MaxItems("Sources", "body", iSourcesSize, 12); err != nil {
|
|
return err
|
|
}
|
|
|
|
for i := 0; i < len(m.Sources); i++ {
|
|
if typeutils.IsZero(m.Sources[i]) { // not required
|
|
continue
|
|
}
|
|
|
|
if m.Sources[i] != nil {
|
|
if err := m.Sources[i].Validate(formats); err != nil {
|
|
ve := new(errors.Validation)
|
|
if stderrors.As(err, &ve) {
|
|
return ve.ValidateName("Sources" + "." + strconv.Itoa(i))
|
|
}
|
|
ce := new(errors.CompositeError)
|
|
if stderrors.As(err, &ce) {
|
|
return ce.ValidateName("Sources" + "." + strconv.Itoa(i))
|
|
}
|
|
|
|
return err
|
|
}
|
|
}
|
|
|
|
}
|
|
|
|
return nil
|
|
}
|
|
|
|
var portfolioEnrichmentRunObservationTypeSubjectEntityTypePropEnum []any
|
|
|
|
func init() {
|
|
var res []string
|
|
if err := json.Unmarshal([]byte(`["company_product","company_service"]`), &res); err != nil {
|
|
panic(err)
|
|
}
|
|
for _, v := range res {
|
|
portfolioEnrichmentRunObservationTypeSubjectEntityTypePropEnum = append(portfolioEnrichmentRunObservationTypeSubjectEntityTypePropEnum, v)
|
|
}
|
|
}
|
|
|
|
const (
|
|
|
|
// PortfolioEnrichmentRunObservationSubjectEntityTypeCompanyProduct captures enum value "company_product"
|
|
PortfolioEnrichmentRunObservationSubjectEntityTypeCompanyProduct string = "company_product"
|
|
|
|
// PortfolioEnrichmentRunObservationSubjectEntityTypeCompanyService captures enum value "company_service"
|
|
PortfolioEnrichmentRunObservationSubjectEntityTypeCompanyService string = "company_service"
|
|
)
|
|
|
|
// prop value enum
|
|
func (m *PortfolioEnrichmentRunObservation) validateSubjectEntityTypeEnum(path, location string, value string) error {
|
|
if err := validate.EnumCase(path, location, value, portfolioEnrichmentRunObservationTypeSubjectEntityTypePropEnum, true); err != nil {
|
|
return err
|
|
}
|
|
return nil
|
|
}
|
|
|
|
func (m *PortfolioEnrichmentRunObservation) validateSubjectEntityType(formats strfmt.Registry) error {
|
|
|
|
if err := validate.Required("SubjectEntityType", "body", m.SubjectEntityType); err != nil {
|
|
return err
|
|
}
|
|
|
|
// value enum
|
|
if err := m.validateSubjectEntityTypeEnum("SubjectEntityType", "body", *m.SubjectEntityType); err != nil {
|
|
return err
|
|
}
|
|
|
|
return nil
|
|
}
|
|
|
|
func (m *PortfolioEnrichmentRunObservation) validateSubjectName(formats strfmt.Registry) error {
|
|
|
|
if err := validate.Required("SubjectName", "body", m.SubjectName); err != nil {
|
|
return err
|
|
}
|
|
|
|
if err := validate.MinLength("SubjectName", "body", *m.SubjectName, 1); err != nil {
|
|
return err
|
|
}
|
|
|
|
if err := validate.MaxLength("SubjectName", "body", *m.SubjectName, 255); err != nil {
|
|
return err
|
|
}
|
|
|
|
return nil
|
|
}
|
|
|
|
func (m *PortfolioEnrichmentRunObservation) validateSummary(formats strfmt.Registry) error {
|
|
|
|
if err := validate.Required("Summary", "body", m.Summary); err != nil {
|
|
return err
|
|
}
|
|
|
|
if err := validate.MinLength("Summary", "body", *m.Summary, 1); err != nil {
|
|
return err
|
|
}
|
|
|
|
if err := validate.MaxLength("Summary", "body", *m.Summary, 2000); err != nil {
|
|
return err
|
|
}
|
|
|
|
return nil
|
|
}
|
|
|
|
func (m *PortfolioEnrichmentRunObservation) validateTargetBaseVersion(formats strfmt.Registry) error {
|
|
if typeutils.IsZero(m.TargetBaseVersion) { // not required
|
|
return nil
|
|
}
|
|
|
|
if err := validate.FormatOf("TargetBaseVersion", "body", "date-time", m.TargetBaseVersion.String(), formats); err != nil {
|
|
return err
|
|
}
|
|
|
|
return nil
|
|
}
|
|
|
|
func (m *PortfolioEnrichmentRunObservation) validateTargetID(formats strfmt.Registry) error {
|
|
if typeutils.IsZero(m.TargetID) { // not required
|
|
return nil
|
|
}
|
|
|
|
if err := validate.MinLength("TargetID", "body", m.TargetID, 1); err != nil {
|
|
return err
|
|
}
|
|
|
|
if err := validate.MaxLength("TargetID", "body", m.TargetID, 64); err != nil {
|
|
return err
|
|
}
|
|
|
|
if err := validate.Pattern("TargetID", "body", m.TargetID, `^[A-Za-z0-9_-]+$`); err != nil {
|
|
return err
|
|
}
|
|
|
|
return nil
|
|
}
|
|
|
|
// ContextValidate validate this portfolio enrichment run observation based on the context it is used
|
|
func (m *PortfolioEnrichmentRunObservation) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
|
|
var res []error
|
|
|
|
if err := m.contextValidateSources(ctx, formats); err != nil {
|
|
res = append(res, err)
|
|
}
|
|
|
|
if len(res) > 0 {
|
|
return errors.CompositeValidationError(res...)
|
|
}
|
|
return nil
|
|
}
|
|
|
|
func (m *PortfolioEnrichmentRunObservation) contextValidateSources(ctx context.Context, formats strfmt.Registry) error {
|
|
|
|
for i := 0; i < len(m.Sources); i++ {
|
|
|
|
if m.Sources[i] != nil {
|
|
|
|
if typeutils.IsZero(m.Sources[i]) { // not required
|
|
return nil
|
|
}
|
|
|
|
if err := m.Sources[i].ContextValidate(ctx, formats); err != nil {
|
|
ve := new(errors.Validation)
|
|
if stderrors.As(err, &ve) {
|
|
return ve.ValidateName("Sources" + "." + strconv.Itoa(i))
|
|
}
|
|
ce := new(errors.CompositeError)
|
|
if stderrors.As(err, &ce) {
|
|
return ce.ValidateName("Sources" + "." + strconv.Itoa(i))
|
|
}
|
|
|
|
return err
|
|
}
|
|
}
|
|
|
|
}
|
|
|
|
return nil
|
|
}
|
|
|
|
// MarshalBinary interface implementation
|
|
func (m *PortfolioEnrichmentRunObservation) MarshalBinary() ([]byte, error) {
|
|
if m == nil {
|
|
return nil, nil
|
|
}
|
|
return jsonutils.WriteJSON(m)
|
|
}
|
|
|
|
// UnmarshalBinary interface implementation
|
|
func (m *PortfolioEnrichmentRunObservation) UnmarshalBinary(b []byte) error {
|
|
var res PortfolioEnrichmentRunObservation
|
|
if err := jsonutils.ReadJSON(b, &res); err != nil {
|
|
return err
|
|
}
|
|
*m = res
|
|
return nil
|
|
}
|