mirror of https://github.com/vernonkeenan/lib
273 lines
6.9 KiB
Go
273 lines
6.9 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"
|
||
|
|
|
||
|
|
"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"
|
||
|
|
)
|
||
|
|
|
||
|
|
// PortfolioEnrichmentMatchFact One deterministic comparison used during reconciliation; it is not a model-confidence score
|
||
|
|
//
|
||
|
|
// swagger:model PortfolioEnrichmentMatchFact
|
||
|
|
type PortfolioEnrichmentMatchFact struct {
|
||
|
|
|
||
|
|
// candidate value
|
||
|
|
// Required: true
|
||
|
|
// Max Length: 2048
|
||
|
|
// Min Length: 1
|
||
|
|
CandidateValue *string `json:"CandidateValue"`
|
||
|
|
|
||
|
|
// matched
|
||
|
|
// Required: true
|
||
|
|
Matched *bool `json:"Matched"`
|
||
|
|
|
||
|
|
// rule
|
||
|
|
// Required: true
|
||
|
|
// Enum: ["exact_name_v1","normalized_name_v1","token_sort_name_v1","exact_url_v1","normalized_url_v1","alias_v1"]
|
||
|
|
Rule *string `json:"Rule"`
|
||
|
|
|
||
|
|
// score
|
||
|
|
// Maximum: 100
|
||
|
|
// Minimum: 0
|
||
|
|
Score *float64 `json:"Score,omitempty"`
|
||
|
|
|
||
|
|
// target ID
|
||
|
|
// Max Length: 64
|
||
|
|
// Min Length: 1
|
||
|
|
// Pattern: ^[A-Za-z0-9_-]+$
|
||
|
|
TargetID string `json:"TargetID,omitempty"`
|
||
|
|
|
||
|
|
// target value
|
||
|
|
// Required: true
|
||
|
|
// Max Length: 2048
|
||
|
|
// Min Length: 1
|
||
|
|
TargetValue *string `json:"TargetValue"`
|
||
|
|
|
||
|
|
// threshold
|
||
|
|
// Maximum: 100
|
||
|
|
// Minimum: 0
|
||
|
|
Threshold *float64 `json:"Threshold,omitempty"`
|
||
|
|
}
|
||
|
|
|
||
|
|
// Validate validates this portfolio enrichment match fact
|
||
|
|
func (m *PortfolioEnrichmentMatchFact) Validate(formats strfmt.Registry) error {
|
||
|
|
var res []error
|
||
|
|
|
||
|
|
if err := m.validateCandidateValue(formats); err != nil {
|
||
|
|
res = append(res, err)
|
||
|
|
}
|
||
|
|
|
||
|
|
if err := m.validateMatched(formats); err != nil {
|
||
|
|
res = append(res, err)
|
||
|
|
}
|
||
|
|
|
||
|
|
if err := m.validateRule(formats); err != nil {
|
||
|
|
res = append(res, err)
|
||
|
|
}
|
||
|
|
|
||
|
|
if err := m.validateScore(formats); err != nil {
|
||
|
|
res = append(res, err)
|
||
|
|
}
|
||
|
|
|
||
|
|
if err := m.validateTargetID(formats); err != nil {
|
||
|
|
res = append(res, err)
|
||
|
|
}
|
||
|
|
|
||
|
|
if err := m.validateTargetValue(formats); err != nil {
|
||
|
|
res = append(res, err)
|
||
|
|
}
|
||
|
|
|
||
|
|
if err := m.validateThreshold(formats); err != nil {
|
||
|
|
res = append(res, err)
|
||
|
|
}
|
||
|
|
|
||
|
|
if len(res) > 0 {
|
||
|
|
return errors.CompositeValidationError(res...)
|
||
|
|
}
|
||
|
|
return nil
|
||
|
|
}
|
||
|
|
|
||
|
|
func (m *PortfolioEnrichmentMatchFact) validateCandidateValue(formats strfmt.Registry) error {
|
||
|
|
|
||
|
|
if err := validate.Required("CandidateValue", "body", m.CandidateValue); err != nil {
|
||
|
|
return err
|
||
|
|
}
|
||
|
|
|
||
|
|
if err := validate.MinLength("CandidateValue", "body", *m.CandidateValue, 1); err != nil {
|
||
|
|
return err
|
||
|
|
}
|
||
|
|
|
||
|
|
if err := validate.MaxLength("CandidateValue", "body", *m.CandidateValue, 2048); err != nil {
|
||
|
|
return err
|
||
|
|
}
|
||
|
|
|
||
|
|
return nil
|
||
|
|
}
|
||
|
|
|
||
|
|
func (m *PortfolioEnrichmentMatchFact) validateMatched(formats strfmt.Registry) error {
|
||
|
|
|
||
|
|
if err := validate.Required("Matched", "body", m.Matched); err != nil {
|
||
|
|
return err
|
||
|
|
}
|
||
|
|
|
||
|
|
return nil
|
||
|
|
}
|
||
|
|
|
||
|
|
var portfolioEnrichmentMatchFactTypeRulePropEnum []any
|
||
|
|
|
||
|
|
func init() {
|
||
|
|
var res []string
|
||
|
|
if err := json.Unmarshal([]byte(`["exact_name_v1","normalized_name_v1","token_sort_name_v1","exact_url_v1","normalized_url_v1","alias_v1"]`), &res); err != nil {
|
||
|
|
panic(err)
|
||
|
|
}
|
||
|
|
for _, v := range res {
|
||
|
|
portfolioEnrichmentMatchFactTypeRulePropEnum = append(portfolioEnrichmentMatchFactTypeRulePropEnum, v)
|
||
|
|
}
|
||
|
|
}
|
||
|
|
|
||
|
|
const (
|
||
|
|
|
||
|
|
// PortfolioEnrichmentMatchFactRuleExactNameV1 captures enum value "exact_name_v1"
|
||
|
|
PortfolioEnrichmentMatchFactRuleExactNameV1 string = "exact_name_v1"
|
||
|
|
|
||
|
|
// PortfolioEnrichmentMatchFactRuleNormalizedNameV1 captures enum value "normalized_name_v1"
|
||
|
|
PortfolioEnrichmentMatchFactRuleNormalizedNameV1 string = "normalized_name_v1"
|
||
|
|
|
||
|
|
// PortfolioEnrichmentMatchFactRuleTokenSortNameV1 captures enum value "token_sort_name_v1"
|
||
|
|
PortfolioEnrichmentMatchFactRuleTokenSortNameV1 string = "token_sort_name_v1"
|
||
|
|
|
||
|
|
// PortfolioEnrichmentMatchFactRuleExactURLV1 captures enum value "exact_url_v1"
|
||
|
|
PortfolioEnrichmentMatchFactRuleExactURLV1 string = "exact_url_v1"
|
||
|
|
|
||
|
|
// PortfolioEnrichmentMatchFactRuleNormalizedURLV1 captures enum value "normalized_url_v1"
|
||
|
|
PortfolioEnrichmentMatchFactRuleNormalizedURLV1 string = "normalized_url_v1"
|
||
|
|
|
||
|
|
// PortfolioEnrichmentMatchFactRuleAliasV1 captures enum value "alias_v1"
|
||
|
|
PortfolioEnrichmentMatchFactRuleAliasV1 string = "alias_v1"
|
||
|
|
)
|
||
|
|
|
||
|
|
// prop value enum
|
||
|
|
func (m *PortfolioEnrichmentMatchFact) validateRuleEnum(path, location string, value string) error {
|
||
|
|
if err := validate.EnumCase(path, location, value, portfolioEnrichmentMatchFactTypeRulePropEnum, true); err != nil {
|
||
|
|
return err
|
||
|
|
}
|
||
|
|
return nil
|
||
|
|
}
|
||
|
|
|
||
|
|
func (m *PortfolioEnrichmentMatchFact) validateRule(formats strfmt.Registry) error {
|
||
|
|
|
||
|
|
if err := validate.Required("Rule", "body", m.Rule); err != nil {
|
||
|
|
return err
|
||
|
|
}
|
||
|
|
|
||
|
|
// value enum
|
||
|
|
if err := m.validateRuleEnum("Rule", "body", *m.Rule); err != nil {
|
||
|
|
return err
|
||
|
|
}
|
||
|
|
|
||
|
|
return nil
|
||
|
|
}
|
||
|
|
|
||
|
|
func (m *PortfolioEnrichmentMatchFact) validateScore(formats strfmt.Registry) error {
|
||
|
|
if typeutils.IsZero(m.Score) { // not required
|
||
|
|
return nil
|
||
|
|
}
|
||
|
|
|
||
|
|
if err := validate.Minimum("Score", "body", *m.Score, 0, false); err != nil {
|
||
|
|
return err
|
||
|
|
}
|
||
|
|
|
||
|
|
if err := validate.Maximum("Score", "body", *m.Score, 100, false); err != nil {
|
||
|
|
return err
|
||
|
|
}
|
||
|
|
|
||
|
|
return nil
|
||
|
|
}
|
||
|
|
|
||
|
|
func (m *PortfolioEnrichmentMatchFact) 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
|
||
|
|
}
|
||
|
|
|
||
|
|
func (m *PortfolioEnrichmentMatchFact) validateTargetValue(formats strfmt.Registry) error {
|
||
|
|
|
||
|
|
if err := validate.Required("TargetValue", "body", m.TargetValue); err != nil {
|
||
|
|
return err
|
||
|
|
}
|
||
|
|
|
||
|
|
if err := validate.MinLength("TargetValue", "body", *m.TargetValue, 1); err != nil {
|
||
|
|
return err
|
||
|
|
}
|
||
|
|
|
||
|
|
if err := validate.MaxLength("TargetValue", "body", *m.TargetValue, 2048); err != nil {
|
||
|
|
return err
|
||
|
|
}
|
||
|
|
|
||
|
|
return nil
|
||
|
|
}
|
||
|
|
|
||
|
|
func (m *PortfolioEnrichmentMatchFact) validateThreshold(formats strfmt.Registry) error {
|
||
|
|
if typeutils.IsZero(m.Threshold) { // not required
|
||
|
|
return nil
|
||
|
|
}
|
||
|
|
|
||
|
|
if err := validate.Minimum("Threshold", "body", *m.Threshold, 0, false); err != nil {
|
||
|
|
return err
|
||
|
|
}
|
||
|
|
|
||
|
|
if err := validate.Maximum("Threshold", "body", *m.Threshold, 100, false); err != nil {
|
||
|
|
return err
|
||
|
|
}
|
||
|
|
|
||
|
|
return nil
|
||
|
|
}
|
||
|
|
|
||
|
|
// ContextValidate validates this portfolio enrichment match fact based on context it is used
|
||
|
|
func (m *PortfolioEnrichmentMatchFact) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
|
||
|
|
return nil
|
||
|
|
}
|
||
|
|
|
||
|
|
// MarshalBinary interface implementation
|
||
|
|
func (m *PortfolioEnrichmentMatchFact) MarshalBinary() ([]byte, error) {
|
||
|
|
if m == nil {
|
||
|
|
return nil, nil
|
||
|
|
}
|
||
|
|
return jsonutils.WriteJSON(m)
|
||
|
|
}
|
||
|
|
|
||
|
|
// UnmarshalBinary interface implementation
|
||
|
|
func (m *PortfolioEnrichmentMatchFact) UnmarshalBinary(b []byte) error {
|
||
|
|
var res PortfolioEnrichmentMatchFact
|
||
|
|
if err := jsonutils.ReadJSON(b, &res); err != nil {
|
||
|
|
return err
|
||
|
|
}
|
||
|
|
*m = res
|
||
|
|
return nil
|
||
|
|
}
|