You are an expert in writing code in many different languages. Your goal is to perform code completion for the following code, keeping in mind the rest of the code and the file meta data.
    Metadata details:
    filename: task_decoder.go
    path of file: ./repos/tania-core/backend/src/tasks/decoder
    
    the code of the file until where you have to start completion: package decoder

import (
	"encoding/json"
	"errors"
	"time"

	"github.com/gofrs/uuid"
	"github.com/mitchellh/mapstructure"
	"github.com/usetania/tania-core/src/tasks/domain"
)

type TaskEventWrapper InterfaceWrapper

func (w *TaskEventWrapper) UnmarshalJSON(b []byte) error {
	wrapper := InterfaceWrapper{}

	err := json.Unmarshal(b, &wrapper)
	if err != nil {
		return err
	}

	mapped := wrapper.Data.(map[string]interface{})

	f := mapstructure.ComposeDecodeHookFunc(
		UIDHook(),
		TimeHook(time.RFC3339),
		TaskDomainDetailHook(),
	)

	switch wrapper.Name {
	case domain.TaskCreatedCode:
		e := do
    
func makeDomainDetails(v interface{}, domainCode string) (domain.TaskDomain, error) {
	mapped := v.(map[string]interface{})

	var domainDetails domain.TaskDomain

	switch domainCode {
	case domain.TaskDomainAreaCode:
		taskDomainArea := domain.TaskDomainArea{}

		if v2, ok2 := mapped["material_id"]; ok2 {
			val, ok2 := v2.(string)
			if !ok2 {
				return domain.TaskDomainArea{}, nil
			}

			uid, err := uuid.FromString(val)
			if err != nil {
				return domain.TaskDomainArea{}, err
			}

			taskDomainArea.MaterialID = &uid
		}

		domainDetails = taskDomainArea

	case domain.TaskDomainCropCode:
		taskDomainCrop := domain.TaskDomainCrop{}

		if v2, ok2 := mapped["material_id"]; ok2 {
			val, ok2 := v2.(string)
			if !ok2 {
				return domain.TaskDomainCrop{}, nil
			}

			uid, err := uuid.FromString(val)
			if err != nil {
				return domain.TaskDomainCrop{}, err
			}

			taskDomainCrop.MaterialID = &uid
		}

		if v2, ok2 := mapped["area_id"]; ok2 {
			val, ok := v2.(string)
			if !ok {
				return domain.TaskDomainCrop{}, nil
			}

			uid, err := uuid.FromString(val)
			if err != nil {
				return domain.TaskDomainCrop{}, err
			}

			taskDomainCrop.AreaID = &uid
		}

		domainDetails = taskDomainCrop
	case domain.TaskDomainFinanceCode:
		domainDetails = domain.TaskDomainFinance{}
	case domain.TaskDomainGeneralCode:
		domainDetails = domain.TaskDomainGeneral{}
	case domain.TaskDomainInventoryCode:
		domainDetails = domain.TaskDomainInventory{}
	case domain.TaskDomainReservoirCode:
		taskDomainReservoir := domain.TaskDomainReservoir{}

		if v2, ok2 := mapped["material_id"]; ok2 {
			val, ok2 := v2.(string)
			if !ok2 {
				return domain.TaskDomainReservoir{}, nil
			}

			uid, err := uuid.FromString(val)
			if err != nil {
				return domain.TaskDomainReservoir{}, err
			}

			taskDomainReservoir.MaterialID = &uid
		}

		domainDetails = taskDomainReservoir
	}

	return domainDetails, nil
}