package mocks

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

// EccKey query methods
type MockSupplierOrganization struct {
	DBMockHelper
	MockListResponse         []common.SupplierOrganization
	MockSupplierOrganization *common.SupplierOrganization
}

func (so *MockSupplierOrganization) Count(supplierOrganization *common.SupplierOrganization) (int, error) {
	return len(so.MockListResponse), so.Error
}

func (so *MockSupplierOrganization) Insert(supplierOrg *common.SupplierOrganization) (orm.Result, error) {
	return so.ORMResponse, so.Error
}

func (so *MockSupplierOrganization) Update(supplierOrg *common.SupplierOrganization) (orm.Result, error) {
	return so.ORMResponse, so.Error
}

func (so *MockSupplierOrganization) Delete(supplierOrg *common.SupplierOrganization) (orm.Result, error) {
	return so.ORMResponse, so.Error
}

func (so *MockSupplierOrganization) Select(supplierOrg *common.SupplierOrganization, paging *queries.PageQueryOptions) ([]common.SupplierOrganization, error) {
	so.LastFilter = supplierOrg
	so.LastPaging = paging

	return so.MockListResponse, so.Error
}

func (c *MockSupplierOrganization) SetListResp(list interface{}) {
	if list != nil {
		c.MockListResponse = list.([]common.SupplierOrganization)
	}
}
