mirror of https://github.com/vernonkeenan/lib
505 lines
13 KiB
Go
505 lines
13 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"
|
|
)
|
|
|
|
// PortfolioEnrichmentRelationshipCandidate One deterministic proposed Product-to-Industry or Service-to-Industry relationship; no relationship is applied by the research contract
|
|
//
|
|
// swagger:model PortfolioEnrichmentRelationshipCandidate
|
|
type PortfolioEnrichmentRelationshipCandidate struct {
|
|
|
|
// existing relationship base version
|
|
// Format: date-time
|
|
ExistingRelationshipBaseVersion strfmt.DateTime `json:"ExistingRelationshipBaseVersion,omitempty"`
|
|
|
|
// Research confirmed whether the authoritative junction exists
|
|
// Required: true
|
|
ExistingRelationshipCaptured *bool `json:"ExistingRelationshipCaptured"`
|
|
|
|
// existing relationship ID
|
|
// Max Length: 64
|
|
// Min Length: 1
|
|
// Pattern: ^[A-Za-z0-9_-]+$
|
|
ExistingRelationshipID string `json:"ExistingRelationshipID,omitempty"`
|
|
|
|
// ID
|
|
// Required: true
|
|
// Format: uuid
|
|
ID *strfmt.UUID `json:"ID"`
|
|
|
|
// match facts
|
|
// Required: true
|
|
// Max Items: 24
|
|
MatchFacts []*PortfolioEnrichmentMatchFact `json:"MatchFacts"`
|
|
|
|
// observed date
|
|
// Required: true
|
|
// Format: date-time
|
|
ObservedDate *strfmt.DateTime `json:"ObservedDate"`
|
|
|
|
// reconciliation action
|
|
// Required: true
|
|
// Enum: ["create","unchanged","ignore"]
|
|
ReconciliationAction *string `json:"ReconciliationAction"`
|
|
|
|
// relationship type
|
|
// Required: true
|
|
// Enum: ["industry_product","industry_service"]
|
|
RelationshipType *string `json:"RelationshipType"`
|
|
|
|
// sources
|
|
// Required: true
|
|
// Max Items: 12
|
|
// Min Items: 1
|
|
Sources []*PortfolioEnrichmentSource `json:"Sources"`
|
|
|
|
// target ID
|
|
// Required: true
|
|
// Max Length: 64
|
|
// Min Length: 1
|
|
// Pattern: ^[A-Za-z0-9_-]+$
|
|
TargetID *string `json:"TargetID"`
|
|
|
|
// target label
|
|
// Required: true
|
|
// Max Length: 255
|
|
// Min Length: 1
|
|
TargetLabel *string `json:"TargetLabel"`
|
|
}
|
|
|
|
// Validate validates this portfolio enrichment relationship candidate
|
|
func (m *PortfolioEnrichmentRelationshipCandidate) Validate(formats strfmt.Registry) error {
|
|
var res []error
|
|
|
|
if err := m.validateExistingRelationshipBaseVersion(formats); err != nil {
|
|
res = append(res, err)
|
|
}
|
|
|
|
if err := m.validateExistingRelationshipCaptured(formats); err != nil {
|
|
res = append(res, err)
|
|
}
|
|
|
|
if err := m.validateExistingRelationshipID(formats); err != nil {
|
|
res = append(res, err)
|
|
}
|
|
|
|
if err := m.validateID(formats); err != nil {
|
|
res = append(res, err)
|
|
}
|
|
|
|
if err := m.validateMatchFacts(formats); err != nil {
|
|
res = append(res, err)
|
|
}
|
|
|
|
if err := m.validateObservedDate(formats); err != nil {
|
|
res = append(res, err)
|
|
}
|
|
|
|
if err := m.validateReconciliationAction(formats); err != nil {
|
|
res = append(res, err)
|
|
}
|
|
|
|
if err := m.validateRelationshipType(formats); err != nil {
|
|
res = append(res, err)
|
|
}
|
|
|
|
if err := m.validateSources(formats); err != nil {
|
|
res = append(res, err)
|
|
}
|
|
|
|
if err := m.validateTargetID(formats); err != nil {
|
|
res = append(res, err)
|
|
}
|
|
|
|
if err := m.validateTargetLabel(formats); err != nil {
|
|
res = append(res, err)
|
|
}
|
|
|
|
if len(res) > 0 {
|
|
return errors.CompositeValidationError(res...)
|
|
}
|
|
return nil
|
|
}
|
|
|
|
func (m *PortfolioEnrichmentRelationshipCandidate) validateExistingRelationshipBaseVersion(formats strfmt.Registry) error {
|
|
if typeutils.IsZero(m.ExistingRelationshipBaseVersion) { // not required
|
|
return nil
|
|
}
|
|
|
|
if err := validate.FormatOf("ExistingRelationshipBaseVersion", "body", "date-time", m.ExistingRelationshipBaseVersion.String(), formats); err != nil {
|
|
return err
|
|
}
|
|
|
|
return nil
|
|
}
|
|
|
|
func (m *PortfolioEnrichmentRelationshipCandidate) validateExistingRelationshipCaptured(formats strfmt.Registry) error {
|
|
|
|
if err := validate.Required("ExistingRelationshipCaptured", "body", m.ExistingRelationshipCaptured); err != nil {
|
|
return err
|
|
}
|
|
|
|
return nil
|
|
}
|
|
|
|
func (m *PortfolioEnrichmentRelationshipCandidate) validateExistingRelationshipID(formats strfmt.Registry) error {
|
|
if typeutils.IsZero(m.ExistingRelationshipID) { // not required
|
|
return nil
|
|
}
|
|
|
|
if err := validate.MinLength("ExistingRelationshipID", "body", m.ExistingRelationshipID, 1); err != nil {
|
|
return err
|
|
}
|
|
|
|
if err := validate.MaxLength("ExistingRelationshipID", "body", m.ExistingRelationshipID, 64); err != nil {
|
|
return err
|
|
}
|
|
|
|
if err := validate.Pattern("ExistingRelationshipID", "body", m.ExistingRelationshipID, `^[A-Za-z0-9_-]+$`); err != nil {
|
|
return err
|
|
}
|
|
|
|
return nil
|
|
}
|
|
|
|
func (m *PortfolioEnrichmentRelationshipCandidate) 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
|
|
}
|
|
|
|
func (m *PortfolioEnrichmentRelationshipCandidate) validateMatchFacts(formats strfmt.Registry) error {
|
|
|
|
if err := validate.Required("MatchFacts", "body", m.MatchFacts); err != nil {
|
|
return err
|
|
}
|
|
|
|
iMatchFactsSize := int64(len(m.MatchFacts))
|
|
|
|
if err := validate.MaxItems("MatchFacts", "body", iMatchFactsSize, 24); err != nil {
|
|
return err
|
|
}
|
|
|
|
for i := 0; i < len(m.MatchFacts); i++ {
|
|
if typeutils.IsZero(m.MatchFacts[i]) { // not required
|
|
continue
|
|
}
|
|
|
|
if m.MatchFacts[i] != nil {
|
|
if err := m.MatchFacts[i].Validate(formats); err != nil {
|
|
ve := new(errors.Validation)
|
|
if stderrors.As(err, &ve) {
|
|
return ve.ValidateName("MatchFacts" + "." + strconv.Itoa(i))
|
|
}
|
|
ce := new(errors.CompositeError)
|
|
if stderrors.As(err, &ce) {
|
|
return ce.ValidateName("MatchFacts" + "." + strconv.Itoa(i))
|
|
}
|
|
|
|
return err
|
|
}
|
|
}
|
|
|
|
}
|
|
|
|
return nil
|
|
}
|
|
|
|
func (m *PortfolioEnrichmentRelationshipCandidate) 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
|
|
}
|
|
|
|
var portfolioEnrichmentRelationshipCandidateTypeReconciliationActionPropEnum []any
|
|
|
|
func init() {
|
|
var res []string
|
|
if err := json.Unmarshal([]byte(`["create","unchanged","ignore"]`), &res); err != nil {
|
|
panic(err)
|
|
}
|
|
for _, v := range res {
|
|
portfolioEnrichmentRelationshipCandidateTypeReconciliationActionPropEnum = append(portfolioEnrichmentRelationshipCandidateTypeReconciliationActionPropEnum, v)
|
|
}
|
|
}
|
|
|
|
const (
|
|
|
|
// PortfolioEnrichmentRelationshipCandidateReconciliationActionCreate captures enum value "create"
|
|
PortfolioEnrichmentRelationshipCandidateReconciliationActionCreate string = "create"
|
|
|
|
// PortfolioEnrichmentRelationshipCandidateReconciliationActionUnchanged captures enum value "unchanged"
|
|
PortfolioEnrichmentRelationshipCandidateReconciliationActionUnchanged string = "unchanged"
|
|
|
|
// PortfolioEnrichmentRelationshipCandidateReconciliationActionIgnore captures enum value "ignore"
|
|
PortfolioEnrichmentRelationshipCandidateReconciliationActionIgnore string = "ignore"
|
|
)
|
|
|
|
// prop value enum
|
|
func (m *PortfolioEnrichmentRelationshipCandidate) validateReconciliationActionEnum(path, location string, value string) error {
|
|
if err := validate.EnumCase(path, location, value, portfolioEnrichmentRelationshipCandidateTypeReconciliationActionPropEnum, true); err != nil {
|
|
return err
|
|
}
|
|
return nil
|
|
}
|
|
|
|
func (m *PortfolioEnrichmentRelationshipCandidate) validateReconciliationAction(formats strfmt.Registry) error {
|
|
|
|
if err := validate.Required("ReconciliationAction", "body", m.ReconciliationAction); err != nil {
|
|
return err
|
|
}
|
|
|
|
// value enum
|
|
if err := m.validateReconciliationActionEnum("ReconciliationAction", "body", *m.ReconciliationAction); err != nil {
|
|
return err
|
|
}
|
|
|
|
return nil
|
|
}
|
|
|
|
var portfolioEnrichmentRelationshipCandidateTypeRelationshipTypePropEnum []any
|
|
|
|
func init() {
|
|
var res []string
|
|
if err := json.Unmarshal([]byte(`["industry_product","industry_service"]`), &res); err != nil {
|
|
panic(err)
|
|
}
|
|
for _, v := range res {
|
|
portfolioEnrichmentRelationshipCandidateTypeRelationshipTypePropEnum = append(portfolioEnrichmentRelationshipCandidateTypeRelationshipTypePropEnum, v)
|
|
}
|
|
}
|
|
|
|
const (
|
|
|
|
// PortfolioEnrichmentRelationshipCandidateRelationshipTypeIndustryProduct captures enum value "industry_product"
|
|
PortfolioEnrichmentRelationshipCandidateRelationshipTypeIndustryProduct string = "industry_product"
|
|
|
|
// PortfolioEnrichmentRelationshipCandidateRelationshipTypeIndustryService captures enum value "industry_service"
|
|
PortfolioEnrichmentRelationshipCandidateRelationshipTypeIndustryService string = "industry_service"
|
|
)
|
|
|
|
// prop value enum
|
|
func (m *PortfolioEnrichmentRelationshipCandidate) validateRelationshipTypeEnum(path, location string, value string) error {
|
|
if err := validate.EnumCase(path, location, value, portfolioEnrichmentRelationshipCandidateTypeRelationshipTypePropEnum, true); err != nil {
|
|
return err
|
|
}
|
|
return nil
|
|
}
|
|
|
|
func (m *PortfolioEnrichmentRelationshipCandidate) validateRelationshipType(formats strfmt.Registry) error {
|
|
|
|
if err := validate.Required("RelationshipType", "body", m.RelationshipType); err != nil {
|
|
return err
|
|
}
|
|
|
|
// value enum
|
|
if err := m.validateRelationshipTypeEnum("RelationshipType", "body", *m.RelationshipType); err != nil {
|
|
return err
|
|
}
|
|
|
|
return nil
|
|
}
|
|
|
|
func (m *PortfolioEnrichmentRelationshipCandidate) 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
|
|
}
|
|
|
|
func (m *PortfolioEnrichmentRelationshipCandidate) validateTargetID(formats strfmt.Registry) error {
|
|
|
|
if err := validate.Required("TargetID", "body", m.TargetID); err != nil {
|
|
return err
|
|
}
|
|
|
|
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
|
|
}
|
|
|
|
func (m *PortfolioEnrichmentRelationshipCandidate) validateTargetLabel(formats strfmt.Registry) error {
|
|
|
|
if err := validate.Required("TargetLabel", "body", m.TargetLabel); err != nil {
|
|
return err
|
|
}
|
|
|
|
if err := validate.MinLength("TargetLabel", "body", *m.TargetLabel, 1); err != nil {
|
|
return err
|
|
}
|
|
|
|
if err := validate.MaxLength("TargetLabel", "body", *m.TargetLabel, 255); err != nil {
|
|
return err
|
|
}
|
|
|
|
return nil
|
|
}
|
|
|
|
// ContextValidate validate this portfolio enrichment relationship candidate based on the context it is used
|
|
func (m *PortfolioEnrichmentRelationshipCandidate) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
|
|
var res []error
|
|
|
|
if err := m.contextValidateMatchFacts(ctx, formats); err != nil {
|
|
res = append(res, err)
|
|
}
|
|
|
|
if err := m.contextValidateSources(ctx, formats); err != nil {
|
|
res = append(res, err)
|
|
}
|
|
|
|
if len(res) > 0 {
|
|
return errors.CompositeValidationError(res...)
|
|
}
|
|
return nil
|
|
}
|
|
|
|
func (m *PortfolioEnrichmentRelationshipCandidate) contextValidateMatchFacts(ctx context.Context, formats strfmt.Registry) error {
|
|
|
|
for i := 0; i < len(m.MatchFacts); i++ {
|
|
|
|
if m.MatchFacts[i] != nil {
|
|
|
|
if typeutils.IsZero(m.MatchFacts[i]) { // not required
|
|
return nil
|
|
}
|
|
|
|
if err := m.MatchFacts[i].ContextValidate(ctx, formats); err != nil {
|
|
ve := new(errors.Validation)
|
|
if stderrors.As(err, &ve) {
|
|
return ve.ValidateName("MatchFacts" + "." + strconv.Itoa(i))
|
|
}
|
|
ce := new(errors.CompositeError)
|
|
if stderrors.As(err, &ce) {
|
|
return ce.ValidateName("MatchFacts" + "." + strconv.Itoa(i))
|
|
}
|
|
|
|
return err
|
|
}
|
|
}
|
|
|
|
}
|
|
|
|
return nil
|
|
}
|
|
|
|
func (m *PortfolioEnrichmentRelationshipCandidate) 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 *PortfolioEnrichmentRelationshipCandidate) MarshalBinary() ([]byte, error) {
|
|
if m == nil {
|
|
return nil, nil
|
|
}
|
|
return jsonutils.WriteJSON(m)
|
|
}
|
|
|
|
// UnmarshalBinary interface implementation
|
|
func (m *PortfolioEnrichmentRelationshipCandidate) UnmarshalBinary(b []byte) error {
|
|
var res PortfolioEnrichmentRelationshipCandidate
|
|
if err := jsonutils.ReadJSON(b, &res); err != nil {
|
|
return err
|
|
}
|
|
*m = res
|
|
return nil
|
|
}
|