// 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"
)

// CompanyProductProposalFieldDecision One complete reviewer decision for a proposed field
//
// swagger:model CompanyProductProposalFieldDecision
type CompanyProductProposalFieldDecision struct {

	// decision
	// Required: true
	// Enum: ["accepted","rejected"]
	Decision *string `json:"Decision"`

	// decision reason
	// Max Length: 1000
	DecisionReason string `json:"DecisionReason,omitempty"`

	// field name
	// Required: true
	// Enum: ["description","enrichmentstatus","fulldescription","imagealttext","imageurl","logo","name","slug","tagline","url"]
	FieldName *string `json:"FieldName"`
}

// Validate validates this company product proposal field decision
func (m *CompanyProductProposalFieldDecision) Validate(formats strfmt.Registry) error {
	var res []error

	if err := m.validateDecision(formats); err != nil {
		res = append(res, err)
	}

	if err := m.validateDecisionReason(formats); err != nil {
		res = append(res, err)
	}

	if err := m.validateFieldName(formats); err != nil {
		res = append(res, err)
	}

	if len(res) > 0 {
		return errors.CompositeValidationError(res...)
	}
	return nil
}

var companyProductProposalFieldDecisionTypeDecisionPropEnum []any

func init() {
	var res []string
	if err := json.Unmarshal([]byte(`["accepted","rejected"]`), &res); err != nil {
		panic(err)
	}
	for _, v := range res {
		companyProductProposalFieldDecisionTypeDecisionPropEnum = append(companyProductProposalFieldDecisionTypeDecisionPropEnum, v)
	}
}

const (

	// CompanyProductProposalFieldDecisionDecisionAccepted captures enum value "accepted"
	CompanyProductProposalFieldDecisionDecisionAccepted string = "accepted"

	// CompanyProductProposalFieldDecisionDecisionRejected captures enum value "rejected"
	CompanyProductProposalFieldDecisionDecisionRejected string = "rejected"
)

// prop value enum
func (m *CompanyProductProposalFieldDecision) validateDecisionEnum(path, location string, value string) error {
	if err := validate.EnumCase(path, location, value, companyProductProposalFieldDecisionTypeDecisionPropEnum, true); err != nil {
		return err
	}
	return nil
}

func (m *CompanyProductProposalFieldDecision) validateDecision(formats strfmt.Registry) error {

	if err := validate.Required("Decision", "body", m.Decision); err != nil {
		return err
	}

	// value enum
	if err := m.validateDecisionEnum("Decision", "body", *m.Decision); err != nil {
		return err
	}

	return nil
}

func (m *CompanyProductProposalFieldDecision) validateDecisionReason(formats strfmt.Registry) error {
	if typeutils.IsZero(m.DecisionReason) { // not required
		return nil
	}

	if err := validate.MaxLength("DecisionReason", "body", m.DecisionReason, 1000); err != nil {
		return err
	}

	return nil
}

var companyProductProposalFieldDecisionTypeFieldNamePropEnum []any

func init() {
	var res []string
	if err := json.Unmarshal([]byte(`["description","enrichmentstatus","fulldescription","imagealttext","imageurl","logo","name","slug","tagline","url"]`), &res); err != nil {
		panic(err)
	}
	for _, v := range res {
		companyProductProposalFieldDecisionTypeFieldNamePropEnum = append(companyProductProposalFieldDecisionTypeFieldNamePropEnum, v)
	}
}

const (

	// CompanyProductProposalFieldDecisionFieldNameDescription captures enum value "description"
	CompanyProductProposalFieldDecisionFieldNameDescription string = "description"

	// CompanyProductProposalFieldDecisionFieldNameEnrichmentstatus captures enum value "enrichmentstatus"
	CompanyProductProposalFieldDecisionFieldNameEnrichmentstatus string = "enrichmentstatus"

	// CompanyProductProposalFieldDecisionFieldNameFulldescription captures enum value "fulldescription"
	CompanyProductProposalFieldDecisionFieldNameFulldescription string = "fulldescription"

	// CompanyProductProposalFieldDecisionFieldNameImagealttext captures enum value "imagealttext"
	CompanyProductProposalFieldDecisionFieldNameImagealttext string = "imagealttext"

	// CompanyProductProposalFieldDecisionFieldNameImageurl captures enum value "imageurl"
	CompanyProductProposalFieldDecisionFieldNameImageurl string = "imageurl"

	// CompanyProductProposalFieldDecisionFieldNameLogo captures enum value "logo"
	CompanyProductProposalFieldDecisionFieldNameLogo string = "logo"

	// CompanyProductProposalFieldDecisionFieldNameName captures enum value "name"
	CompanyProductProposalFieldDecisionFieldNameName string = "name"

	// CompanyProductProposalFieldDecisionFieldNameSlug captures enum value "slug"
	CompanyProductProposalFieldDecisionFieldNameSlug string = "slug"

	// CompanyProductProposalFieldDecisionFieldNameTagline captures enum value "tagline"
	CompanyProductProposalFieldDecisionFieldNameTagline string = "tagline"

	// CompanyProductProposalFieldDecisionFieldNameURL captures enum value "url"
	CompanyProductProposalFieldDecisionFieldNameURL string = "url"
)

// prop value enum
func (m *CompanyProductProposalFieldDecision) validateFieldNameEnum(path, location string, value string) error {
	if err := validate.EnumCase(path, location, value, companyProductProposalFieldDecisionTypeFieldNamePropEnum, true); err != nil {
		return err
	}
	return nil
}

func (m *CompanyProductProposalFieldDecision) validateFieldName(formats strfmt.Registry) error {

	if err := validate.Required("FieldName", "body", m.FieldName); err != nil {
		return err
	}

	// value enum
	if err := m.validateFieldNameEnum("FieldName", "body", *m.FieldName); err != nil {
		return err
	}

	return nil
}

// ContextValidate validates this company product proposal field decision based on context it is used
func (m *CompanyProductProposalFieldDecision) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
	return nil
}

// MarshalBinary interface implementation
func (m *CompanyProductProposalFieldDecision) MarshalBinary() ([]byte, error) {
	if m == nil {
		return nil, nil
	}
	return jsonutils.WriteJSON(m)
}

// UnmarshalBinary interface implementation
func (m *CompanyProductProposalFieldDecision) UnmarshalBinary(b []byte) error {
	var res CompanyProductProposalFieldDecision
	if err := jsonutils.ReadJSON(b, &res); err != nil {
		return err
	}
	*m = res
	return nil
}
