// 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 ops_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"
)

// Eft A group of Electronic Fund Transfer Items posted to a payment gateway
//
// swagger:model Eft
type Eft struct {

	// Account
	AccountID string `json:"AccountID,omitempty"`

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

	// Attempt Number
	AttemptNumber float64 `json:"AttemptNumber,omitempty"`

	// Backend
	BackendID string `json:"BackendID,omitempty"`

	// Billing Run
	BillingRunID string `json:"BillingRunID,omitempty"`

	// Cash Receipt
	CashReceiptID string `json:"CashReceiptID,omitempty"`

	// Created By
	CreatedByID string `json:"CreatedByID,omitempty"`

	// Created Date
	CreatedDate string `json:"CreatedDate,omitempty"`

	// Executed At
	Executed string `json:"Executed,omitempty"`

	// Fee
	Fee float64 `json:"Fee,omitempty"`

	// Gateway
	Gateway string `json:"Gateway,omitempty"`

	// Gateway Key
	GatewayKey string `json:"GatewayKey,omitempty"`

	// Gateway Message
	GatewayMessage string `json:"GatewayMessage,omitempty"`

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

	// The items associated with this EFT
	Items []*EftItem `json:"Items"`

	// Journal Date
	JournalDate string `json:"JournalDate,omitempty"`

	// Last Modified By
	LastModifiedByID string `json:"LastModifiedByID,omitempty"`

	// Last Modified Date
	LastModifiedDate string `json:"LastModifiedDate,omitempty"`

	// Parent Foreign Key
	ParentFK string `json:"ParentFK,omitempty"`

	// Payment Method
	PaymentMethodID string `json:"PaymentMethodID,omitempty"`

	// External Reference
	Ref string `json:"Ref,omitempty"`

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

	// ID of the Tenant that owns this object
	TenantID string `json:"TenantID,omitempty"`

	// Transaction ID
	TransactionID string `json:"TransactionID,omitempty"`

	// UUID
	UUID string `json:"UUID,omitempty"`
}

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

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

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

func (m *Eft) validateItems(formats strfmt.Registry) error {

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

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

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

	}

	return nil
}

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

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