package mocks

import (
	"github.com/fiskerinc/cloud-services/pkg/common"

	"github.com/go-pg/pg/v10/orm"
	"github.com/jinzhu/copier"
)

// EccKey query methods
type MockEccKeys struct {
	DBMockHelper
	MockListResponse []common.ECCKeys
	MockEccKeys      common.ECCKeys
}

func (ek MockEccKeys) Insert(keys common.ECCKeys) (orm.Result, error) {
	return ek.ORMResponse, ek.Error
}

func (ek MockEccKeys) SelectAllPrivateKeys() ([]common.ECCKeys, error) {
	return ek.MockListResponse, ek.Error
}

func (ek MockEccKeys) SelectAllPrivateKeysByEnv(env string) ([]common.ECCKeys, error) {
	return ek.MockListResponse, ek.Error
}

func (ek MockEccKeys) SelectPublicKeysByECUByEnv(ecu string, env string) (common.ECCKeys, error) {
	return ek.MockEccKeys, ek.Error
}

func (ek MockEccKeys) SelectAllPublicKeysByEnv(env string) ([]common.ECCKeys, error) {
	return ek.MockListResponse, ek.Error
}

func (ek MockEccKeys) SelectPrivateKeysByECUsEnv(ecus []string, env string) ([]common.ECCKeys, error) {
	result := []common.ECCKeys{}
	copier.Copy(&result, &ek.MockListResponse)
	return result, ek.Error
}

func (ek MockEccKeys) SelectAllPrivateKeysByVIN(env string) ([]common.ECCKeys, error) {
	result := []common.ECCKeys{}
	copier.Copy(&result, &ek.MockListResponse)
	return result, ek.Error
}

func (ek MockEccKeys) SelectAllPrivateKeysByCarUpdateID(id int64) ([]common.ECCKeys, error) {
	result := []common.ECCKeys{}
	copier.Copy(&result, &ek.MockListResponse)
	return result, ek.Error
}
