package queries

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

type CarConfigDataInterface interface {
	SelectByVIN(vin string) (common.CarConfigData, error)
}

type CarConfigData struct {
	QueryBase
}

func (c *CarConfigData) SelectByVIN(vin string) (common.CarConfigData, error) {
	config := common.CarConfigData{}

	err := c.GetDBConn().Model(&config).Where("vin = ?", vin).Select()

	return config, errors.WithStack(err)
}
