// 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" ) // PortfolioOperatorOffering One bounded operator-supplied offering lead; Research treats every field as untrusted context and verifies it against public evidence // // swagger:model PortfolioOperatorOffering type PortfolioOperatorOffering struct { // description // Max Length: 2000 // Min Length: 1 Description string `json:"Description,omitempty"` // entity type hint // Enum: ["company_product","company_service","unspecified"] EntityTypeHint string `json:"EntityTypeHint,omitempty"` // name // Required: true // Max Length: 255 // Min Length: 1 Name *string `json:"Name"` // URL // Max Length: 2048 // Format: uri URL strfmt.URI `json:"URL,omitempty"` } // Validate validates this portfolio operator offering func (m *PortfolioOperatorOffering) Validate(formats strfmt.Registry) error { var res []error if err := m.validateDescription(formats); err != nil { res = append(res, err) } if err := m.validateEntityTypeHint(formats); err != nil { res = append(res, err) } if err := m.validateName(formats); err != nil { res = append(res, err) } if err := m.validateURL(formats); err != nil { res = append(res, err) } if len(res) > 0 { return errors.CompositeValidationError(res...) } return nil } func (m *PortfolioOperatorOffering) validateDescription(formats strfmt.Registry) error { if typeutils.IsZero(m.Description) { // not required return nil } if err := validate.MinLength("Description", "body", m.Description, 1); err != nil { return err } if err := validate.MaxLength("Description", "body", m.Description, 2000); err != nil { return err } return nil } var portfolioOperatorOfferingTypeEntityTypeHintPropEnum []any func init() { var res []string if err := json.Unmarshal([]byte(`["company_product","company_service","unspecified"]`), &res); err != nil { panic(err) } for _, v := range res { portfolioOperatorOfferingTypeEntityTypeHintPropEnum = append(portfolioOperatorOfferingTypeEntityTypeHintPropEnum, v) } } const ( // PortfolioOperatorOfferingEntityTypeHintCompanyProduct captures enum value "company_product" PortfolioOperatorOfferingEntityTypeHintCompanyProduct string = "company_product" // PortfolioOperatorOfferingEntityTypeHintCompanyService captures enum value "company_service" PortfolioOperatorOfferingEntityTypeHintCompanyService string = "company_service" // PortfolioOperatorOfferingEntityTypeHintUnspecified captures enum value "unspecified" PortfolioOperatorOfferingEntityTypeHintUnspecified string = "unspecified" ) // prop value enum func (m *PortfolioOperatorOffering) validateEntityTypeHintEnum(path, location string, value string) error { if err := validate.EnumCase(path, location, value, portfolioOperatorOfferingTypeEntityTypeHintPropEnum, true); err != nil { return err } return nil } func (m *PortfolioOperatorOffering) validateEntityTypeHint(formats strfmt.Registry) error { if typeutils.IsZero(m.EntityTypeHint) { // not required return nil } // value enum if err := m.validateEntityTypeHintEnum("EntityTypeHint", "body", m.EntityTypeHint); err != nil { return err } return nil } func (m *PortfolioOperatorOffering) validateName(formats strfmt.Registry) error { if err := validate.Required("Name", "body", m.Name); err != nil { return err } if err := validate.MinLength("Name", "body", *m.Name, 1); err != nil { return err } if err := validate.MaxLength("Name", "body", *m.Name, 255); err != nil { return err } return nil } func (m *PortfolioOperatorOffering) validateURL(formats strfmt.Registry) error { if typeutils.IsZero(m.URL) { // not required return nil } if err := validate.MaxLength("URL", "body", m.URL.String(), 2048); err != nil { return err } if err := validate.FormatOf("URL", "body", "uri", m.URL.String(), formats); err != nil { return err } return nil } // ContextValidate validates this portfolio operator offering based on context it is used func (m *PortfolioOperatorOffering) ContextValidate(ctx context.Context, formats strfmt.Registry) error { return nil } // MarshalBinary interface implementation func (m *PortfolioOperatorOffering) MarshalBinary() ([]byte, error) { if m == nil { return nil, nil } return jsonutils.WriteJSON(m) } // UnmarshalBinary interface implementation func (m *PortfolioOperatorOffering) UnmarshalBinary(b []byte) error { var res PortfolioOperatorOffering if err := jsonutils.ReadJSON(b, &res); err != nil { return err } *m = res return nil }