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

package models

// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command

import (
	"context"
	"encoding/json"

	"github.com/go-openapi/errors"
	"github.com/go-openapi/strfmt"
	"github.com/go-openapi/swag"
	"github.com/go-openapi/validate"
)

// EditOrgOption EditOrgOption options for editing an organization
//
// swagger:model EditOrgOption
type EditOrgOption struct {

	// description
	Description string `json:"description,omitempty"`

	// email
	Email string `json:"email,omitempty"`

	// full name
	FullName string `json:"full_name,omitempty"`

	// location
	Location string `json:"location,omitempty"`

	// repo admin change team access
	RepoAdminChangeTeamAccess bool `json:"repo_admin_change_team_access,omitempty"`

	// possible values are `public`, `limited` or `private`
	// Enum: ["public","limited","private"]
	Visibility string `json:"visibility,omitempty"`

	// website
	Website string `json:"website,omitempty"`
}

// Validate validates this edit org option
func (m *EditOrgOption) Validate(formats strfmt.Registry) error {
	var res []error

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

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

var editOrgOptionTypeVisibilityPropEnum []interface{}

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

const (

	// EditOrgOptionVisibilityPublic captures enum value "public"
	EditOrgOptionVisibilityPublic string = "public"

	// EditOrgOptionVisibilityLimited captures enum value "limited"
	EditOrgOptionVisibilityLimited string = "limited"

	// EditOrgOptionVisibilityPrivate captures enum value "private"
	EditOrgOptionVisibilityPrivate string = "private"
)

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

func (m *EditOrgOption) validateVisibility(formats strfmt.Registry) error {
	if swag.IsZero(m.Visibility) { // not required
		return nil
	}

	// value enum
	if err := m.validateVisibilityEnum("visibility", "body", m.Visibility); err != nil {
		return err
	}

	return nil
}

// ContextValidate validates this edit org option based on context it is used
func (m *EditOrgOption) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
	return nil
}

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

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