package molders

// |@@| C

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

type UpdatePlantTaskFormMolder struct {
}

func (this *UpdatePlantTaskFormMolder) ToEntity(form *forms.UpdatePlantTaskForm, entity *mdl.PlantTask) (*mdl.PlantTask, []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.PlantId != form.PlantId {
		entity.PlantId = form.PlantId
		changes = append(changes, "PlantId")
	}
	return entity, changes
}
func (this *UpdatePlantTaskFormMolder) ToForm(form *forms.UpdatePlantTaskForm, entity *mdl.PlantTask) *forms.UpdatePlantTaskForm {
	form.Id = entity.Id
	form.Description = entity.Description
	form.Name = entity.Name
	form.StartDate = entity.StartDate
	form.PlantId = entity.PlantId
	return form
}
