package molders

// |@@| C

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

type UpdateGardenFormMolder struct {
}

func (this *UpdateGardenFormMolder) ToEntity(form *forms.UpdateGardenForm, entity *mdl.Garden) (*mdl.Garden, []string) {
	var changes []string
	if entity.Name != form.Name {
		entity.Name = form.Name
		changes = append(changes, "Name")
	}
	if entity.Picture != form.Picture {
		entity.Picture = form.Picture
		changes = append(changes, "Picture")
	}
	return entity, changes
}
func (this *UpdateGardenFormMolder) ToForm(form *forms.UpdateGardenForm, entity *mdl.Garden) *forms.UpdateGardenForm {
	form.Id = entity.Id
	form.Name = entity.Name
	form.Picture = entity.Picture
	return form
}
