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

// ManageableTenant manageable tenant
//
// swagger:model ManageableTenant
type ManageableTenant struct {

	// active
	Active *bool `json:"active,omitempty"`

	// actor access level
	// Required: true
	// Enum: ["estate_administrator","owner","manager"]
	ActorAccessLevel *string `json:"actorAccessLevel"`

	// id
	// Required: true
	// Max Length: 36
	// Min Length: 1
	ID *string `json:"id"`

	// status
	Status *string `json:"status,omitempty"`

	// tenant name
	// Required: true
	TenantName *string `json:"tenantName"`

	// tenant type
	TenantType *string `json:"tenantType,omitempty"`
}

// Validate validates this manageable tenant
func (m *ManageableTenant) Validate(formats strfmt.Registry) error {
	var res []error

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

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

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

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

var manageableTenantTypeActorAccessLevelPropEnum []any

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

const (

	// ManageableTenantActorAccessLevelEstateAdministrator captures enum value "estate_administrator"
	ManageableTenantActorAccessLevelEstateAdministrator string = "estate_administrator"

	// ManageableTenantActorAccessLevelOwner captures enum value "owner"
	ManageableTenantActorAccessLevelOwner string = "owner"

	// ManageableTenantActorAccessLevelManager captures enum value "manager"
	ManageableTenantActorAccessLevelManager string = "manager"
)

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

func (m *ManageableTenant) validateActorAccessLevel(formats strfmt.Registry) error {

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

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

	return nil
}

func (m *ManageableTenant) validateID(formats strfmt.Registry) error {

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

	if err := validate.MinLength("id", "body", *m.ID, 1); err != nil {
		return err
	}

	if err := validate.MaxLength("id", "body", *m.ID, 36); err != nil {
		return err
	}

	return nil
}

func (m *ManageableTenant) validateTenantName(formats strfmt.Registry) error {

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

	return nil
}

// ContextValidate validates this manageable tenant based on context it is used
func (m *ManageableTenant) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
	return nil
}

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

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