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

// All Code Copyright(c) 2018-2020 by Taxnexus, Inc.
// All rights reserved worldwide.
// Proprietary product; unlicensed use is not allowed

package sf_gate_models

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

import (
	"strconv"

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

// LicenseType license type
//
// swagger:model LicenseType
type LicenseType struct {

	// accountid
	Accountid string `json:"accountid,omitempty"`

	// agentid
	Agentid string `json:"agentid,omitempty"`

	// contactid
	Contactid string `json:"contactid,omitempty"`

	// Cost
	Cost float64 `json:"cost,omitempty"`

	// createdbyid
	Createdbyid string `json:"createdbyid,omitempty"`

	// createddate
	Createddate string `json:"createddate,omitempty"`

	// domainid
	Domainid string `json:"domainid,omitempty"`

	// domains
	Domains []string `json:"domains"`

	// Frequency
	Frequency string `json:"frequency,omitempty"`

	// Taxnexus Record Id
	ID string `json:"id,omitempty"`

	// jurisdictions
	Jurisdictions []*GeoLicenseTypeInstance `json:"jurisdictions"`

	// lastmodifiedbyid
	Lastmodifiedbyid string `json:"lastmodifiedbyid,omitempty"`

	// lastmodifieddate
	Lastmodifieddate string `json:"lastmodifieddate,omitempty"`

	// Level
	Level string `json:"level,omitempty"`

	// License Type Name
	Name string `json:"name,omitempty"`

	// Picklist Value
	Picklistvalue string `json:"picklistvalue,omitempty"`

	// Source System identifier for this record, if any
	Ref string `json:"ref,omitempty"`

	// Restriction
	Restriction string `json:"restriction,omitempty"`

	// Tier
	Tier string `json:"tier,omitempty"`
}

// Validate validates this license type
func (m *LicenseType) Validate(formats strfmt.Registry) error {
	var res []error

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

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

func (m *LicenseType) validateJurisdictions(formats strfmt.Registry) error {

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

	for i := 0; i < len(m.Jurisdictions); i++ {
		if swag.IsZero(m.Jurisdictions[i]) { // not required
			continue
		}

		if m.Jurisdictions[i] != nil {
			if err := m.Jurisdictions[i].Validate(formats); err != nil {
				if ve, ok := err.(*errors.Validation); ok {
					return ve.ValidateName("jurisdictions" + "." + strconv.Itoa(i))
				}
				return err
			}
		}

	}

	return nil
}

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

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