package molders

// |@@| C

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

type UpdateSeedProgramFormMolder struct {
}

func (this *UpdateSeedProgramFormMolder) ToEntity(form *forms.UpdateSeedProgramForm, entity *mdl.SeedProgram) (*mdl.SeedProgram, []string) {
	var changes []string
	if entity.Contact != form.Contact {
		entity.Contact = form.Contact
		changes = append(changes, "Contact")
	}
	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.PlantId != form.PlantId {
		entity.PlantId = form.PlantId
		changes = append(changes, "PlantId")
	}
	return entity, changes
}
func (this *UpdateSeedProgramFormMolder) ToForm(form *forms.UpdateSeedProgramForm, entity *mdl.SeedProgram) *forms.UpdateSeedProgramForm {
	form.Id = entity.Id
	form.Contact = entity.Contact
	form.Description = entity.Description
	form.Name = entity.Name
	form.PlantId = entity.PlantId
	return form
}
