/*
 * OPEN OUTCRY API
 *
 * # Introduction This API is documented in **OpenAPI 3.0 format**.  This API the following operations: * Retrieve a list of available instruments * Retrieve a list of executed trades  # Basics * API calls have to be secured with HTTPS. * All data has to be submitted UTF-8 encoded. * The reply is sent JSON encoded.
 *
 * API version: 1.0.0
 * Generated by: OpenAPI Generator (https://openapi-generator.tech)
 */

package api

type Payment struct {
	Id string `json:"id"`

	Type PaymentType `json:"type"`

	Amount float64 `json:"amount"`

	// ISO 4217 Currency symbol
	Currency string `json:"currency"`

	SenderAccountId string `json:"senderAccountId"`

	BeneficiaryAccountId string `json:"beneficiaryAccountId"`

	Details string `json:"details"`

	ExternalReferenceNumber string `json:"externalReferenceNumber"`

	Status string `json:"status"`

	DebitBalanceAmount float64 `json:"debitBalanceAmount,omitempty"`

	CreditBalanceAmount float64 `json:"creditBalanceAmount,omitempty"`
}

// AssertPaymentRequired checks if the required fields are not zero-ed
func AssertPaymentRequired(obj Payment) error {
	elements := map[string]interface{}{
		"id":                      obj.Id,
		"type":                    obj.Type,
		"amount":                  obj.Amount,
		"currency":                obj.Currency,
		"senderAccountId":         obj.SenderAccountId,
		"beneficiaryAccountId":    obj.BeneficiaryAccountId,
		"details":                 obj.Details,
		"externalReferenceNumber": obj.ExternalReferenceNumber,
		"status":                  obj.Status,
	}
	for name, el := range elements {
		if isZero := IsZeroValue(el); isZero {
			return &RequiredError{Field: name}
		}
	}

	return nil
}

// AssertPaymentConstraints checks if the values respects the defined constraints
func AssertPaymentConstraints(obj Payment) error {
	return nil
}
