package molders

// |@@| C

import (
	"gardening/src/dat/forms"
	"gardening/src/mdl"
)

type UpdateGardenTaskFormMolder struct {
}

func (this *UpdateGardenTaskFormMolder) ToEntity(form *forms.UpdateGardenTaskForm, entity *mdl.GardenTask) (*mdl.GardenTask, []string) {
	var changes []string
	if entity.Description != form.Description {
		entity.Description = form.Description
		changes = append(changes, "Description")
	}
	if entity.Name != form.Name {
		entity.Name = form.Name
		changes = append(changes, "Name")
	}
	if entity.StartDate != form.StartDate {
		entity.StartDate = form.StartDate
		changes = append(changes, "StartDate")
	}
	if entity.GardenId != form.GardenId {
		entity.GardenId = form.GardenId
		changes = append(changes, "GardenId")
	}
	if entity.PlantationId != form.PlantationId {
		entity.PlantationId = form.PlantationId
		changes = append(changes, "PlantationId")
	}
	return entity, changes
}
func (this *UpdateGardenTaskFormMolder) ToForm(form *forms.UpdateGardenTaskForm, entity *mdl.GardenTask) *forms.UpdateGardenTaskForm {
	form.Id = entity.Id
	form.Description = entity.Description
	form.Name = entity.Name
	form.StartDate = entity.StartDate
	form.GardenId = entity.GardenId
	form.PlantationId = entity.PlantationId
	return form
}
