// 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 (
	"encoding/json"

	strfmt "github.com/go-openapi/strfmt"

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

// GetCharactersCharacterIDMailLabelsOKBodyLabelsItems get_characters_character_id_mail_labels_label
//
// label object
// swagger:model getCharactersCharacterIdMailLabelsOKBodyLabelsItems

type GetCharactersCharacterIDMailLabelsOKBodyLabelsItems struct {

	// get_characters_character_id_mail_labels_color
	//
	// color string
	Color *string `json:"color,omitempty"`

	// get_characters_character_id_mail_labels_label_id
	//
	// label_id integer
	// Minimum: 0
	LabelID *int32 `json:"label_id,omitempty"`

	// get_characters_character_id_mail_labels_name
	//
	// name string
	// Max Length: 40
	Name string `json:"name,omitempty"`

	// get_characters_character_id_mail_labels_unread_count
	//
	// unread_count integer
	// Minimum: 0
	UnreadCount *int32 `json:"unread_count,omitempty"`
}

/* polymorph getCharactersCharacterIdMailLabelsOKBodyLabelsItems color false */

/* polymorph getCharactersCharacterIdMailLabelsOKBodyLabelsItems label_id false */

/* polymorph getCharactersCharacterIdMailLabelsOKBodyLabelsItems name false */

/* polymorph getCharactersCharacterIdMailLabelsOKBodyLabelsItems unread_count false */

// Validate validates this get characters character Id mail labels o k body labels items
func (m *GetCharactersCharacterIDMailLabelsOKBodyLabelsItems) Validate(formats strfmt.Registry) error {
	var res []error

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

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

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

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

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

var getCharactersCharacterIdMailLabelsOKBodyLabelsItemsTypeColorPropEnum []interface{}

func init() {
	var res []string
	if err := json.Unmarshal([]byte(`["#ffffff","#ffff01","#ff6600","#fe0000","#9a0000","#660066","#0000fe","#0099ff","#01ffff","#00ff33","#349800","#006634","#666666","#999999","#e6e6e6","#ffffcd","#99ffff","#ccff9a"]`), &res); err != nil {
		panic(err)
	}
	for _, v := range res {
		getCharactersCharacterIdMailLabelsOKBodyLabelsItemsTypeColorPropEnum = append(getCharactersCharacterIdMailLabelsOKBodyLabelsItemsTypeColorPropEnum, v)
	}
}

const (
	// GetCharactersCharacterIDMailLabelsOKBodyLabelsItemsColorNrFfffff captures enum value "#ffffff"
	GetCharactersCharacterIDMailLabelsOKBodyLabelsItemsColorNrFfffff string = "#ffffff"
	// GetCharactersCharacterIDMailLabelsOKBodyLabelsItemsColorNrFfff01 captures enum value "#ffff01"
	GetCharactersCharacterIDMailLabelsOKBodyLabelsItemsColorNrFfff01 string = "#ffff01"
	// GetCharactersCharacterIDMailLabelsOKBodyLabelsItemsColorNrFf6600 captures enum value "#ff6600"
	GetCharactersCharacterIDMailLabelsOKBodyLabelsItemsColorNrFf6600 string = "#ff6600"
	// GetCharactersCharacterIDMailLabelsOKBodyLabelsItemsColorNrFe0000 captures enum value "#fe0000"
	GetCharactersCharacterIDMailLabelsOKBodyLabelsItemsColorNrFe0000 string = "#fe0000"
	// GetCharactersCharacterIDMailLabelsOKBodyLabelsItemsColorNr9a0000 captures enum value "#9a0000"
	GetCharactersCharacterIDMailLabelsOKBodyLabelsItemsColorNr9a0000 string = "#9a0000"
	// GetCharactersCharacterIDMailLabelsOKBodyLabelsItemsColorNr660066 captures enum value "#660066"
	GetCharactersCharacterIDMailLabelsOKBodyLabelsItemsColorNr660066 string = "#660066"
	// GetCharactersCharacterIDMailLabelsOKBodyLabelsItemsColorNr0000fe captures enum value "#0000fe"
	GetCharactersCharacterIDMailLabelsOKBodyLabelsItemsColorNr0000fe string = "#0000fe"
	// GetCharactersCharacterIDMailLabelsOKBodyLabelsItemsColorNr0099ff captures enum value "#0099ff"
	GetCharactersCharacterIDMailLabelsOKBodyLabelsItemsColorNr0099ff string = "#0099ff"
	// GetCharactersCharacterIDMailLabelsOKBodyLabelsItemsColorNr01ffff captures enum value "#01ffff"
	GetCharactersCharacterIDMailLabelsOKBodyLabelsItemsColorNr01ffff string = "#01ffff"
	// GetCharactersCharacterIDMailLabelsOKBodyLabelsItemsColorNr00ff33 captures enum value "#00ff33"
	GetCharactersCharacterIDMailLabelsOKBodyLabelsItemsColorNr00ff33 string = "#00ff33"
	// GetCharactersCharacterIDMailLabelsOKBodyLabelsItemsColorNr349800 captures enum value "#349800"
	GetCharactersCharacterIDMailLabelsOKBodyLabelsItemsColorNr349800 string = "#349800"
	// GetCharactersCharacterIDMailLabelsOKBodyLabelsItemsColorNr006634 captures enum value "#006634"
	GetCharactersCharacterIDMailLabelsOKBodyLabelsItemsColorNr006634 string = "#006634"
	// GetCharactersCharacterIDMailLabelsOKBodyLabelsItemsColorNr666666 captures enum value "#666666"
	GetCharactersCharacterIDMailLabelsOKBodyLabelsItemsColorNr666666 string = "#666666"
	// GetCharactersCharacterIDMailLabelsOKBodyLabelsItemsColorNr999999 captures enum value "#999999"
	GetCharactersCharacterIDMailLabelsOKBodyLabelsItemsColorNr999999 string = "#999999"
	// GetCharactersCharacterIDMailLabelsOKBodyLabelsItemsColorNrE6e6e6 captures enum value "#e6e6e6"
	GetCharactersCharacterIDMailLabelsOKBodyLabelsItemsColorNrE6e6e6 string = "#e6e6e6"
	// GetCharactersCharacterIDMailLabelsOKBodyLabelsItemsColorNrFfffcd captures enum value "#ffffcd"
	GetCharactersCharacterIDMailLabelsOKBodyLabelsItemsColorNrFfffcd string = "#ffffcd"
	// GetCharactersCharacterIDMailLabelsOKBodyLabelsItemsColorNr99ffff captures enum value "#99ffff"
	GetCharactersCharacterIDMailLabelsOKBodyLabelsItemsColorNr99ffff string = "#99ffff"
	// GetCharactersCharacterIDMailLabelsOKBodyLabelsItemsColorNrCcff9a captures enum value "#ccff9a"
	GetCharactersCharacterIDMailLabelsOKBodyLabelsItemsColorNrCcff9a string = "#ccff9a"
)

// prop value enum
func (m *GetCharactersCharacterIDMailLabelsOKBodyLabelsItems) validateColorEnum(path, location string, value string) error {
	if err := validate.Enum(path, location, value, getCharactersCharacterIdMailLabelsOKBodyLabelsItemsTypeColorPropEnum); err != nil {
		return err
	}
	return nil
}

func (m *GetCharactersCharacterIDMailLabelsOKBodyLabelsItems) validateColor(formats strfmt.Registry) error {

	if swag.IsZero(m.Color) { // not required
		return nil
	}

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

	return nil
}

func (m *GetCharactersCharacterIDMailLabelsOKBodyLabelsItems) validateLabelID(formats strfmt.Registry) error {

	if swag.IsZero(m.LabelID) { // not required
		return nil
	}

	if err := validate.MinimumInt("label_id", "body", int64(*m.LabelID), 0, false); err != nil {
		return err
	}

	return nil
}

func (m *GetCharactersCharacterIDMailLabelsOKBodyLabelsItems) validateName(formats strfmt.Registry) error {

	if swag.IsZero(m.Name) { // not required
		return nil
	}

	if err := validate.MaxLength("name", "body", string(m.Name), 40); err != nil {
		return err
	}

	return nil
}

func (m *GetCharactersCharacterIDMailLabelsOKBodyLabelsItems) validateUnreadCount(formats strfmt.Registry) error {

	if swag.IsZero(m.UnreadCount) { // not required
		return nil
	}

	if err := validate.MinimumInt("unread_count", "body", int64(*m.UnreadCount), 0, false); err != nil {
		return err
	}

	return nil
}

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

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