package app

import "code.tnxs.net/taxnexus/lib/api/ops/ops_models"

// MarshalToSwagger encodes first class object
func (obj *Total) MarshalToSwagger() *ops_models.Total {
	var items []*ops_models.TotalItem
	if obj.TotalItems != nil {
		items = []*ops_models.TotalItem{}
		for _, itm := range obj.TotalItems {
			items = append(items, &ops_models.TotalItem{
				ID:          itm.ID,
				Amount:      itm.Amount,
				Count:       itm.Count,
				DisplayName: itm.DisplayName,
				TenantID:    itm.TenantID,
			})
		}
	}
	return &ops_models.Total{
		ID:               obj.ID,
		Amount:           obj.Amount,
		BusinessTax:      obj.BusinessTax,
		BusinessTaxRate:  obj.BusinessTaxRate,
		CannabisTax:      obj.CannabisTax,
		CannabisTaxRate:  obj.CannabisTaxRate,
		Items:            items,
		MonthlyAmount:    obj.MonthlyAmount,
		ObjectType:       obj.ObjectType,
		PurchaseAmount:   obj.PurchaseAmount,
		SalesTaxRate:     obj.SalesTaxRate,
		SalesTax:         obj.SalesTax,
		ShippingHandling: obj.ShippingHandling,
		Subtotal:         obj.Subtotal,
		TelecomTax:       obj.TelecomTax,
		TelecomTaxRate:   obj.TelecomTaxRate,
	}
}
