// Code generated by go-swagger; DO NOT EDIT.

package cli

import (
	"fmt"

	"github.com/spf13/cobra"

	"github.com/go-swagger/go-swagger/examples/cli/models"
)

// Schema cli for GithubReactions

// register flags to command
func registerModelGithubReactionsFlags(depth int, cmdPrefix string, cmd *cobra.Command) error {

	if err := registerGithubReactionsPropPlus1(depth, cmdPrefix, cmd); err != nil {
		return err
	}

	if err := registerGithubReactionsPropMinus1(depth, cmdPrefix, cmd); err != nil {
		return err
	}

	if err := registerGithubReactionsPropConfused(depth, cmdPrefix, cmd); err != nil {
		return err
	}

	return nil
}

func registerGithubReactionsPropPlus1(depth int, cmdPrefix string, cmd *cobra.Command) error {
	if depth > maxDepth {
		return nil
	}

	flagPlus1Description := ``

	var flagPlus1Name string
	if cmdPrefix == "" {
		flagPlus1Name = "+1"
	} else {
		flagPlus1Name = fmt.Sprintf("%v.+1", cmdPrefix)
	}

	var flagPlus1Default int64

	_ = cmd.PersistentFlags().Int64(flagPlus1Name, flagPlus1Default, flagPlus1Description)

	return nil
}

func registerGithubReactionsPropMinus1(depth int, cmdPrefix string, cmd *cobra.Command) error {
	if depth > maxDepth {
		return nil
	}

	flagMinus1Description := ``

	var flagMinus1Name string
	if cmdPrefix == "" {
		flagMinus1Name = "-1"
	} else {
		flagMinus1Name = fmt.Sprintf("%v.-1", cmdPrefix)
	}

	var flagMinus1Default int64

	_ = cmd.PersistentFlags().Int64(flagMinus1Name, flagMinus1Default, flagMinus1Description)

	return nil
}

func registerGithubReactionsPropConfused(depth int, cmdPrefix string, cmd *cobra.Command) error {
	if depth > maxDepth {
		return nil
	}

	flagConfusedDescription := ``

	var flagConfusedName string
	if cmdPrefix == "" {
		flagConfusedName = "confused"
	} else {
		flagConfusedName = fmt.Sprintf("%v.confused", cmdPrefix)
	}

	var flagConfusedDefault int64

	_ = cmd.PersistentFlags().Int64(flagConfusedName, flagConfusedDefault, flagConfusedDescription)

	return nil
}

// retrieve flags from commands, and set value in model. Return true if any flag is passed by user to fill model field.
func retrieveModelGithubReactionsFlags(depth int, m *models.GithubReactions, cmdPrefix string, cmd *cobra.Command) (error, bool) {
	retAdded := false

	err, Plus1Added := retrieveGithubReactionsPropPlus1Flags(depth, m, cmdPrefix, cmd)
	if err != nil {
		return err, false
	}
	retAdded = retAdded || Plus1Added

	err, Minus1Added := retrieveGithubReactionsPropMinus1Flags(depth, m, cmdPrefix, cmd)
	if err != nil {
		return err, false
	}
	retAdded = retAdded || Minus1Added

	err, ConfusedAdded := retrieveGithubReactionsPropConfusedFlags(depth, m, cmdPrefix, cmd)
	if err != nil {
		return err, false
	}
	retAdded = retAdded || ConfusedAdded

	return nil, retAdded
}

func retrieveGithubReactionsPropPlus1Flags(depth int, m *models.GithubReactions, cmdPrefix string, cmd *cobra.Command) (error, bool) {
	if depth > maxDepth {
		return nil, false
	}
	retAdded := false

	flagPlus1Name := fmt.Sprintf("%v.+1", cmdPrefix)
	if cmd.Flags().Changed(flagPlus1Name) {

		var flagPlus1Name string
		if cmdPrefix == "" {
			flagPlus1Name = "+1"
		} else {
			flagPlus1Name = fmt.Sprintf("%v.+1", cmdPrefix)
		}

		flagPlus1Value, err := cmd.Flags().GetInt64(flagPlus1Name)
		if err != nil {
			return err, false
		}
		m.Plus1 = flagPlus1Value

		retAdded = true
	}

	return nil, retAdded
}

func retrieveGithubReactionsPropMinus1Flags(depth int, m *models.GithubReactions, cmdPrefix string, cmd *cobra.Command) (error, bool) {
	if depth > maxDepth {
		return nil, false
	}
	retAdded := false

	flagMinus1Name := fmt.Sprintf("%v.-1", cmdPrefix)
	if cmd.Flags().Changed(flagMinus1Name) {

		var flagMinus1Name string
		if cmdPrefix == "" {
			flagMinus1Name = "-1"
		} else {
			flagMinus1Name = fmt.Sprintf("%v.-1", cmdPrefix)
		}

		flagMinus1Value, err := cmd.Flags().GetInt64(flagMinus1Name)
		if err != nil {
			return err, false
		}
		m.Minus1 = flagMinus1Value

		retAdded = true
	}

	return nil, retAdded
}

func retrieveGithubReactionsPropConfusedFlags(depth int, m *models.GithubReactions, cmdPrefix string, cmd *cobra.Command) (error, bool) {
	if depth > maxDepth {
		return nil, false
	}
	retAdded := false

	flagConfusedName := fmt.Sprintf("%v.confused", cmdPrefix)
	if cmd.Flags().Changed(flagConfusedName) {

		var flagConfusedName string
		if cmdPrefix == "" {
			flagConfusedName = "confused"
		} else {
			flagConfusedName = fmt.Sprintf("%v.confused", cmdPrefix)
		}

		flagConfusedValue, err := cmd.Flags().GetInt64(flagConfusedName)
		if err != nil {
			return err, false
		}
		m.Confused = flagConfusedValue

		retAdded = true
	}

	return nil, retAdded
}
