package flags

import "fmt"

func (flags *Flags) parseRole() (err error) {

	// Ensure that role field is not empty
	if flags.Vars.Role == "" {
		return fmt.Errorf("Role cannot be empty")
	}

	// Ensure that role field is valid
	if flags.Vars.Role != "scheduler" && flags.Vars.Role != "agent" {
		return fmt.Errorf("Role must be either 'scheduler' or 'agent'")
	}

	return nil
}
