package mocks

import (
	"time"

	"github.com/fiskerinc/cloud-services/pkg/common"
	"github.com/fiskerinc/cloud-services/pkg/db/queries"
	"github.com/go-pg/pg/v10/orm"
)

type MockCarVersionsLog struct {
	MockLogVersionChange func(log *common.CarVersionLogs) (orm.Result, error)
	MockSelectByVIN      func(vin string, options *queries.PageQueryOptions) ([]common.CarVersionLogs, int, error)
	GetCarVersionsResult map[string]string
	DBMockHelper
}

func (m MockCarVersionsLog) LogVersionChange(log *common.CarVersionLogs) (orm.Result, error) {
	return m.MockLogVersionChange(log)
}

func (m MockCarVersionsLog) SelectByVIN(vin string, options *queries.PageQueryOptions) ([]common.CarVersionLogs, int, error) {
	return m.MockSelectByVIN(vin, options)
}

func (m MockCarVersionsLog) GetCarVersions(vin string, timestamp time.Time) (map[string]string, error) {
	if m.Error != nil {
		return nil, m.Error
	}

	return m.GetCarVersionsResult, nil
}
