mirror of https://github.com/vernonkeenan/lib
216 lines
5.3 KiB
Go
216 lines
5.3 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"
|
|
)
|
|
|
|
// PortfolioOperatorFacts Optional bounded portfolio_operator_facts.v1 discovery context; it contains no authority, provider, model, prompt, tenant, or actor controls
|
|
//
|
|
// swagger:model PortfolioOperatorFacts
|
|
type PortfolioOperatorFacts struct {
|
|
|
|
// company overview
|
|
// Max Length: 4000
|
|
// Min Length: 1
|
|
CompanyOverview string `json:"CompanyOverview,omitempty"`
|
|
|
|
// offerings
|
|
// Max Items: 50
|
|
Offerings []*PortfolioOperatorOffering `json:"Offerings"`
|
|
|
|
// protocol version
|
|
// Required: true
|
|
// Enum: ["portfolio_operator_facts.v1"]
|
|
ProtocolVersion *string `json:"ProtocolVersion"`
|
|
}
|
|
|
|
// Validate validates this portfolio operator facts
|
|
func (m *PortfolioOperatorFacts) Validate(formats strfmt.Registry) error {
|
|
var res []error
|
|
|
|
if err := m.validateCompanyOverview(formats); err != nil {
|
|
res = append(res, err)
|
|
}
|
|
|
|
if err := m.validateOfferings(formats); err != nil {
|
|
res = append(res, err)
|
|
}
|
|
|
|
if err := m.validateProtocolVersion(formats); err != nil {
|
|
res = append(res, err)
|
|
}
|
|
|
|
if len(res) > 0 {
|
|
return errors.CompositeValidationError(res...)
|
|
}
|
|
return nil
|
|
}
|
|
|
|
func (m *PortfolioOperatorFacts) validateCompanyOverview(formats strfmt.Registry) error {
|
|
if typeutils.IsZero(m.CompanyOverview) { // not required
|
|
return nil
|
|
}
|
|
|
|
if err := validate.MinLength("CompanyOverview", "body", m.CompanyOverview, 1); err != nil {
|
|
return err
|
|
}
|
|
|
|
if err := validate.MaxLength("CompanyOverview", "body", m.CompanyOverview, 4000); err != nil {
|
|
return err
|
|
}
|
|
|
|
return nil
|
|
}
|
|
|
|
func (m *PortfolioOperatorFacts) validateOfferings(formats strfmt.Registry) error {
|
|
if typeutils.IsZero(m.Offerings) { // not required
|
|
return nil
|
|
}
|
|
|
|
iOfferingsSize := int64(len(m.Offerings))
|
|
|
|
if err := validate.MaxItems("Offerings", "body", iOfferingsSize, 50); err != nil {
|
|
return err
|
|
}
|
|
|
|
for i := 0; i < len(m.Offerings); i++ {
|
|
if typeutils.IsZero(m.Offerings[i]) { // not required
|
|
continue
|
|
}
|
|
|
|
if m.Offerings[i] != nil {
|
|
if err := m.Offerings[i].Validate(formats); err != nil {
|
|
ve := new(errors.Validation)
|
|
if stderrors.As(err, &ve) {
|
|
return ve.ValidateName("Offerings" + "." + strconv.Itoa(i))
|
|
}
|
|
ce := new(errors.CompositeError)
|
|
if stderrors.As(err, &ce) {
|
|
return ce.ValidateName("Offerings" + "." + strconv.Itoa(i))
|
|
}
|
|
|
|
return err
|
|
}
|
|
}
|
|
|
|
}
|
|
|
|
return nil
|
|
}
|
|
|
|
var portfolioOperatorFactsTypeProtocolVersionPropEnum []any
|
|
|
|
func init() {
|
|
var res []string
|
|
if err := json.Unmarshal([]byte(`["portfolio_operator_facts.v1"]`), &res); err != nil {
|
|
panic(err)
|
|
}
|
|
for _, v := range res {
|
|
portfolioOperatorFactsTypeProtocolVersionPropEnum = append(portfolioOperatorFactsTypeProtocolVersionPropEnum, v)
|
|
}
|
|
}
|
|
|
|
const (
|
|
|
|
// PortfolioOperatorFactsProtocolVersionPortfolioOperatorFactsDotV1 captures enum value "portfolio_operator_facts.v1"
|
|
PortfolioOperatorFactsProtocolVersionPortfolioOperatorFactsDotV1 string = "portfolio_operator_facts.v1"
|
|
)
|
|
|
|
// prop value enum
|
|
func (m *PortfolioOperatorFacts) validateProtocolVersionEnum(path, location string, value string) error {
|
|
if err := validate.EnumCase(path, location, value, portfolioOperatorFactsTypeProtocolVersionPropEnum, true); err != nil {
|
|
return err
|
|
}
|
|
return nil
|
|
}
|
|
|
|
func (m *PortfolioOperatorFacts) validateProtocolVersion(formats strfmt.Registry) error {
|
|
|
|
if err := validate.Required("ProtocolVersion", "body", m.ProtocolVersion); err != nil {
|
|
return err
|
|
}
|
|
|
|
// value enum
|
|
if err := m.validateProtocolVersionEnum("ProtocolVersion", "body", *m.ProtocolVersion); err != nil {
|
|
return err
|
|
}
|
|
|
|
return nil
|
|
}
|
|
|
|
// ContextValidate validate this portfolio operator facts based on the context it is used
|
|
func (m *PortfolioOperatorFacts) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
|
|
var res []error
|
|
|
|
if err := m.contextValidateOfferings(ctx, formats); err != nil {
|
|
res = append(res, err)
|
|
}
|
|
|
|
if len(res) > 0 {
|
|
return errors.CompositeValidationError(res...)
|
|
}
|
|
return nil
|
|
}
|
|
|
|
func (m *PortfolioOperatorFacts) contextValidateOfferings(ctx context.Context, formats strfmt.Registry) error {
|
|
|
|
for i := 0; i < len(m.Offerings); i++ {
|
|
|
|
if m.Offerings[i] != nil {
|
|
|
|
if typeutils.IsZero(m.Offerings[i]) { // not required
|
|
return nil
|
|
}
|
|
|
|
if err := m.Offerings[i].ContextValidate(ctx, formats); err != nil {
|
|
ve := new(errors.Validation)
|
|
if stderrors.As(err, &ve) {
|
|
return ve.ValidateName("Offerings" + "." + strconv.Itoa(i))
|
|
}
|
|
ce := new(errors.CompositeError)
|
|
if stderrors.As(err, &ce) {
|
|
return ce.ValidateName("Offerings" + "." + strconv.Itoa(i))
|
|
}
|
|
|
|
return err
|
|
}
|
|
}
|
|
|
|
}
|
|
|
|
return nil
|
|
}
|
|
|
|
// MarshalBinary interface implementation
|
|
func (m *PortfolioOperatorFacts) MarshalBinary() ([]byte, error) {
|
|
if m == nil {
|
|
return nil, nil
|
|
}
|
|
return jsonutils.WriteJSON(m)
|
|
}
|
|
|
|
// UnmarshalBinary interface implementation
|
|
func (m *PortfolioOperatorFacts) UnmarshalBinary(b []byte) error {
|
|
var res PortfolioOperatorFacts
|
|
if err := jsonutils.ReadJSON(b, &res); err != nil {
|
|
return err
|
|
}
|
|
*m = res
|
|
return nil
|
|
}
|