package com.ecep.contract.service;

import java.util.List;

import org.springframework.stereotype.Service;
import org.springframework.data.domain.Pageable;

import com.ecep.contract.util.ParamUtils;
import com.ecep.contract.vo.ContractBidVendorVo;
import com.ecep.contract.vm.ContractBidVendorViewModel;
import com.ecep.contract.vo.ContractVo;
import com.ecep.contract.vo.CompanyVo;

@Service
public class ContractBidVendorService extends QueryService<ContractBidVendorVo, ContractBidVendorViewModel> {

    public List<ContractBidVendorVo> findByContract(ContractVo contract) {
        return findAll(ParamUtils.builder()
                .equals("contract", contract.getId())
                .build(), Pageable.unpaged()).getContent();
    }

    public List<ContractBidVendorVo> findByContractAndCompany(ContractVo contract, CompanyVo company) {
        return findAll(ParamUtils.builder()
                .equals("contract", contract.getId())
                .equals("company", company.getId())
                .build(), Pageable.unpaged()).getContent();
    }

    @Override
    public ContractBidVendorViewModel createNewViewModel() {
        return new ContractBidVendorViewModel();
    }
}
