// 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 (
	"github.com/go-openapi/errors"
	"github.com/go-openapi/strfmt"
	"github.com/go-openapi/swag"
)

// Subscription subscription
//
// swagger:model Subscription
type Subscription struct {

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

	// Activated Date
	Activateddate string `json:"activateddate,omitempty"`

	// Activated By
	Activateduserid string `json:"activateduserid,omitempty"`

	// Allowed Minutes Inbound
	Allowedminutesinbound float64 `json:"allowedminutesinbound,omitempty"`

	// Allowed Minutes Outbound
	Allowedminutesoutbound float64 `json:"allowedminutesoutbound,omitempty"`

	// Amount
	Amount float64 `json:"amount,omitempty"`

	// Asset Name
	Assetid string `json:"assetid,omitempty"`

	// Audit Trail Message
	Auditmessage string `json:"auditmessage,omitempty"`

	// Cancel Date
	Canceldate string `json:"canceldate,omitempty"`

	// contract
	Contract *ContractBasic `json:"contract,omitempty"`

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

	// Direction Sensitive Rating?
	Directionsensitive bool `json:"directionsensitive,omitempty"`

	// Effective Date
	Effectivedate string `json:"effectivedate,omitempty"`

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

	// enduserid
	Enduserid string `json:"enduserid,omitempty"`

	// Fax Emails
	FaxEmails string `json:"fax_emails,omitempty"`

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

	// Active?
	Isactive bool `json:"isactive,omitempty"`

	// Order Date
	Orderdate string `json:"orderdate,omitempty"`

	// Order Item
	Orderitemid string `json:"orderitemid,omitempty"`

	// Overage Rate Inbound
	Overagerateinbound float64 `json:"overagerateinbound,omitempty"`

	// Overage Rate Outbound
	Overagerateoutbound float64 `json:"overagerateoutbound,omitempty"`

	// Password
	Password string `json:"password,omitempty"`

	// Payment Terms
	Paymentterms string `json:"paymentterms,omitempty"`

	// Price Book
	Pricebookid string `json:"pricebookid,omitempty"`

	// Product Code
	Productcode string `json:"productcode,omitempty"`

	// Product record ID
	Productid string `json:"productid,omitempty"`

	// Product Name
	Productname string `json:"productname,omitempty"`

	// Quantity
	Quantity string `json:"quantity,omitempty"`

	// Quote Item
	Quoteitemid string `json:"quoteitemid,omitempty"`

	// Subscription ID
	Seq string `json:"seq,omitempty"`

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

	// Suretax Code
	Suretax string `json:"suretax,omitempty"`

	// tenant identifier
	Tenantid string `json:"tenantid,omitempty"`

	// tollfreeRating
	Tollfreerating bool `json:"tollfreerating,omitempty"`

	// Type
	Type string `json:"type,omitempty"`

	// Unit Price
	Unitprice float64 `json:"unitprice,omitempty"`

	// Units
	Units string `json:"units,omitempty"`

	// Unlimited usage?
	Unlimited bool `json:"unlimited,omitempty"`

	// Username
	Username string `json:"username,omitempty"`
}

// Validate validates this subscription
func (m *Subscription) Validate(formats strfmt.Registry) error {
	var res []error

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

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

func (m *Subscription) validateContract(formats strfmt.Registry) error {

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

	if m.Contract != nil {
		if err := m.Contract.Validate(formats); err != nil {
			if ve, ok := err.(*errors.Validation); ok {
				return ve.ValidateName("contract")
			}
			return err
		}
	}

	return nil
}

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

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