mirror of https://github.com/vernonkeenan/lib
324 lines
7.6 KiB
Go
324 lines
7.6 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/validate"
|
||
|
|
)
|
||
|
|
|
||
|
|
// CompanyProductPublication Bounded append-only publication receipt; credentials and client principal keys are never exposed
|
||
|
|
//
|
||
|
|
// swagger:model CompanyProductPublication
|
||
|
|
type CompanyProductPublication struct {
|
||
|
|
|
||
|
|
// actor user ID
|
||
|
|
// Required: true
|
||
|
|
// Format: uuid
|
||
|
|
ActorUserID *strfmt.UUID `json:"ActorUserID"`
|
||
|
|
|
||
|
|
// base version
|
||
|
|
// Required: true
|
||
|
|
// Format: date-time
|
||
|
|
BaseVersion *strfmt.DateTime `json:"BaseVersion"`
|
||
|
|
|
||
|
|
// company product ID
|
||
|
|
// Required: true
|
||
|
|
// Format: uuid
|
||
|
|
CompanyProductID *strfmt.UUID `json:"CompanyProductID"`
|
||
|
|
|
||
|
|
// created date
|
||
|
|
// Required: true
|
||
|
|
// Format: date-time
|
||
|
|
CreatedDate *strfmt.DateTime `json:"CreatedDate"`
|
||
|
|
|
||
|
|
// from published
|
||
|
|
// Required: true
|
||
|
|
FromPublished *bool `json:"FromPublished"`
|
||
|
|
|
||
|
|
// ID
|
||
|
|
// Required: true
|
||
|
|
// Format: uuid
|
||
|
|
ID *strfmt.UUID `json:"ID"`
|
||
|
|
|
||
|
|
// operation
|
||
|
|
// Required: true
|
||
|
|
// Enum: ["publish","republish"]
|
||
|
|
Operation *string `json:"Operation"`
|
||
|
|
|
||
|
|
// proposal ID
|
||
|
|
// Required: true
|
||
|
|
// Format: uuid
|
||
|
|
ProposalID *strfmt.UUID `json:"ProposalID"`
|
||
|
|
|
||
|
|
// reason
|
||
|
|
// Required: true
|
||
|
|
// Max Length: 1000
|
||
|
|
// Min Length: 1
|
||
|
|
Reason *string `json:"Reason"`
|
||
|
|
|
||
|
|
// resulting version
|
||
|
|
// Required: true
|
||
|
|
// Format: date-time
|
||
|
|
ResultingVersion *strfmt.DateTime `json:"ResultingVersion"`
|
||
|
|
|
||
|
|
// to published
|
||
|
|
// Required: true
|
||
|
|
ToPublished *bool `json:"ToPublished"`
|
||
|
|
}
|
||
|
|
|
||
|
|
// Validate validates this company product publication
|
||
|
|
func (m *CompanyProductPublication) Validate(formats strfmt.Registry) error {
|
||
|
|
var res []error
|
||
|
|
|
||
|
|
if err := m.validateActorUserID(formats); err != nil {
|
||
|
|
res = append(res, err)
|
||
|
|
}
|
||
|
|
|
||
|
|
if err := m.validateBaseVersion(formats); err != nil {
|
||
|
|
res = append(res, err)
|
||
|
|
}
|
||
|
|
|
||
|
|
if err := m.validateCompanyProductID(formats); err != nil {
|
||
|
|
res = append(res, err)
|
||
|
|
}
|
||
|
|
|
||
|
|
if err := m.validateCreatedDate(formats); err != nil {
|
||
|
|
res = append(res, err)
|
||
|
|
}
|
||
|
|
|
||
|
|
if err := m.validateFromPublished(formats); err != nil {
|
||
|
|
res = append(res, err)
|
||
|
|
}
|
||
|
|
|
||
|
|
if err := m.validateID(formats); err != nil {
|
||
|
|
res = append(res, err)
|
||
|
|
}
|
||
|
|
|
||
|
|
if err := m.validateOperation(formats); err != nil {
|
||
|
|
res = append(res, err)
|
||
|
|
}
|
||
|
|
|
||
|
|
if err := m.validateProposalID(formats); err != nil {
|
||
|
|
res = append(res, err)
|
||
|
|
}
|
||
|
|
|
||
|
|
if err := m.validateReason(formats); err != nil {
|
||
|
|
res = append(res, err)
|
||
|
|
}
|
||
|
|
|
||
|
|
if err := m.validateResultingVersion(formats); err != nil {
|
||
|
|
res = append(res, err)
|
||
|
|
}
|
||
|
|
|
||
|
|
if err := m.validateToPublished(formats); err != nil {
|
||
|
|
res = append(res, err)
|
||
|
|
}
|
||
|
|
|
||
|
|
if len(res) > 0 {
|
||
|
|
return errors.CompositeValidationError(res...)
|
||
|
|
}
|
||
|
|
return nil
|
||
|
|
}
|
||
|
|
|
||
|
|
func (m *CompanyProductPublication) validateActorUserID(formats strfmt.Registry) error {
|
||
|
|
|
||
|
|
if err := validate.Required("ActorUserID", "body", m.ActorUserID); err != nil {
|
||
|
|
return err
|
||
|
|
}
|
||
|
|
|
||
|
|
if err := validate.FormatOf("ActorUserID", "body", "uuid", m.ActorUserID.String(), formats); err != nil {
|
||
|
|
return err
|
||
|
|
}
|
||
|
|
|
||
|
|
return nil
|
||
|
|
}
|
||
|
|
|
||
|
|
func (m *CompanyProductPublication) validateBaseVersion(formats strfmt.Registry) error {
|
||
|
|
|
||
|
|
if err := validate.Required("BaseVersion", "body", m.BaseVersion); err != nil {
|
||
|
|
return err
|
||
|
|
}
|
||
|
|
|
||
|
|
if err := validate.FormatOf("BaseVersion", "body", "date-time", m.BaseVersion.String(), formats); err != nil {
|
||
|
|
return err
|
||
|
|
}
|
||
|
|
|
||
|
|
return nil
|
||
|
|
}
|
||
|
|
|
||
|
|
func (m *CompanyProductPublication) validateCompanyProductID(formats strfmt.Registry) error {
|
||
|
|
|
||
|
|
if err := validate.Required("CompanyProductID", "body", m.CompanyProductID); err != nil {
|
||
|
|
return err
|
||
|
|
}
|
||
|
|
|
||
|
|
if err := validate.FormatOf("CompanyProductID", "body", "uuid", m.CompanyProductID.String(), formats); err != nil {
|
||
|
|
return err
|
||
|
|
}
|
||
|
|
|
||
|
|
return nil
|
||
|
|
}
|
||
|
|
|
||
|
|
func (m *CompanyProductPublication) validateCreatedDate(formats strfmt.Registry) error {
|
||
|
|
|
||
|
|
if err := validate.Required("CreatedDate", "body", m.CreatedDate); err != nil {
|
||
|
|
return err
|
||
|
|
}
|
||
|
|
|
||
|
|
if err := validate.FormatOf("CreatedDate", "body", "date-time", m.CreatedDate.String(), formats); err != nil {
|
||
|
|
return err
|
||
|
|
}
|
||
|
|
|
||
|
|
return nil
|
||
|
|
}
|
||
|
|
|
||
|
|
func (m *CompanyProductPublication) validateFromPublished(formats strfmt.Registry) error {
|
||
|
|
|
||
|
|
if err := validate.Required("FromPublished", "body", m.FromPublished); err != nil {
|
||
|
|
return err
|
||
|
|
}
|
||
|
|
|
||
|
|
return nil
|
||
|
|
}
|
||
|
|
|
||
|
|
func (m *CompanyProductPublication) 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 companyProductPublicationTypeOperationPropEnum []any
|
||
|
|
|
||
|
|
func init() {
|
||
|
|
var res []string
|
||
|
|
if err := json.Unmarshal([]byte(`["publish","republish"]`), &res); err != nil {
|
||
|
|
panic(err)
|
||
|
|
}
|
||
|
|
for _, v := range res {
|
||
|
|
companyProductPublicationTypeOperationPropEnum = append(companyProductPublicationTypeOperationPropEnum, v)
|
||
|
|
}
|
||
|
|
}
|
||
|
|
|
||
|
|
const (
|
||
|
|
|
||
|
|
// CompanyProductPublicationOperationPublish captures enum value "publish"
|
||
|
|
CompanyProductPublicationOperationPublish string = "publish"
|
||
|
|
|
||
|
|
// CompanyProductPublicationOperationRepublish captures enum value "republish"
|
||
|
|
CompanyProductPublicationOperationRepublish string = "republish"
|
||
|
|
)
|
||
|
|
|
||
|
|
// prop value enum
|
||
|
|
func (m *CompanyProductPublication) validateOperationEnum(path, location string, value string) error {
|
||
|
|
if err := validate.EnumCase(path, location, value, companyProductPublicationTypeOperationPropEnum, true); err != nil {
|
||
|
|
return err
|
||
|
|
}
|
||
|
|
return nil
|
||
|
|
}
|
||
|
|
|
||
|
|
func (m *CompanyProductPublication) validateOperation(formats strfmt.Registry) error {
|
||
|
|
|
||
|
|
if err := validate.Required("Operation", "body", m.Operation); err != nil {
|
||
|
|
return err
|
||
|
|
}
|
||
|
|
|
||
|
|
// value enum
|
||
|
|
if err := m.validateOperationEnum("Operation", "body", *m.Operation); err != nil {
|
||
|
|
return err
|
||
|
|
}
|
||
|
|
|
||
|
|
return nil
|
||
|
|
}
|
||
|
|
|
||
|
|
func (m *CompanyProductPublication) validateProposalID(formats strfmt.Registry) error {
|
||
|
|
|
||
|
|
if err := validate.Required("ProposalID", "body", m.ProposalID); err != nil {
|
||
|
|
return err
|
||
|
|
}
|
||
|
|
|
||
|
|
if err := validate.FormatOf("ProposalID", "body", "uuid", m.ProposalID.String(), formats); err != nil {
|
||
|
|
return err
|
||
|
|
}
|
||
|
|
|
||
|
|
return nil
|
||
|
|
}
|
||
|
|
|
||
|
|
func (m *CompanyProductPublication) validateReason(formats strfmt.Registry) error {
|
||
|
|
|
||
|
|
if err := validate.Required("Reason", "body", m.Reason); err != nil {
|
||
|
|
return err
|
||
|
|
}
|
||
|
|
|
||
|
|
if err := validate.MinLength("Reason", "body", *m.Reason, 1); err != nil {
|
||
|
|
return err
|
||
|
|
}
|
||
|
|
|
||
|
|
if err := validate.MaxLength("Reason", "body", *m.Reason, 1000); err != nil {
|
||
|
|
return err
|
||
|
|
}
|
||
|
|
|
||
|
|
return nil
|
||
|
|
}
|
||
|
|
|
||
|
|
func (m *CompanyProductPublication) validateResultingVersion(formats strfmt.Registry) error {
|
||
|
|
|
||
|
|
if err := validate.Required("ResultingVersion", "body", m.ResultingVersion); err != nil {
|
||
|
|
return err
|
||
|
|
}
|
||
|
|
|
||
|
|
if err := validate.FormatOf("ResultingVersion", "body", "date-time", m.ResultingVersion.String(), formats); err != nil {
|
||
|
|
return err
|
||
|
|
}
|
||
|
|
|
||
|
|
return nil
|
||
|
|
}
|
||
|
|
|
||
|
|
func (m *CompanyProductPublication) validateToPublished(formats strfmt.Registry) error {
|
||
|
|
|
||
|
|
if err := validate.Required("ToPublished", "body", m.ToPublished); err != nil {
|
||
|
|
return err
|
||
|
|
}
|
||
|
|
|
||
|
|
return nil
|
||
|
|
}
|
||
|
|
|
||
|
|
// ContextValidate validates this company product publication based on context it is used
|
||
|
|
func (m *CompanyProductPublication) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
|
||
|
|
return nil
|
||
|
|
}
|
||
|
|
|
||
|
|
// MarshalBinary interface implementation
|
||
|
|
func (m *CompanyProductPublication) MarshalBinary() ([]byte, error) {
|
||
|
|
if m == nil {
|
||
|
|
return nil, nil
|
||
|
|
}
|
||
|
|
return jsonutils.WriteJSON(m)
|
||
|
|
}
|
||
|
|
|
||
|
|
// UnmarshalBinary interface implementation
|
||
|
|
func (m *CompanyProductPublication) UnmarshalBinary(b []byte) error {
|
||
|
|
var res CompanyProductPublication
|
||
|
|
if err := jsonutils.ReadJSON(b, &res); err != nil {
|
||
|
|
return err
|
||
|
|
}
|
||
|
|
*m = res
|
||
|
|
return nil
|
||
|
|
}
|