package queries

import "github.com/go-pg/pg/v10/orm"

type UpdateManifestMode interface {
	LoadRelations(query *orm.Query) error
	SelectByVINCondition(query *orm.Query) *orm.Query
}

type DefaultMode struct{}

func (DefaultMode) LoadRelations(query *orm.Query) error {
	return query.Relation("ECUs").
		Relation("ECUs.Files").
		Relation("ECUs.Files.WriteRegion").
		Relation("ECUs.Files.EraseRegion").
		Select()
}

func (DefaultMode) SelectByVINCondition(query *orm.Query) *orm.Query {
	return query
}
