<?php
class BidsModel{
    public function getBids($filter){
        $bidsHandler = new Bids();

        return $bidsHandler->getBids($filter);
    }

    public function removeBid($idBid){
        $bidsHandler = new Bids();

        return $bidsHandler->removeBid($idBid);
    }

    public function getClCustomers(){
        $clCustomersHandler = new ClCustomers();

        return $clCustomersHandler->getClAndCustomers();
    }

    public function getPayTypes($idCommercialLead, $idCustomer, $idPackage){
        $packages = new Packages();
        $data['prices'] = $packages->getPricesForPackages($idCommercialLead, $idPackage, 1, 0, $idCustomer);
        $data['prices'] = isset($data['prices'][$idPackage]) ? $data['prices'][$idPackage] : [];

        return $data['prices'];
    }

    public function getPackages($idCommercialLead, $idCustomer){
        $customerPackagesHandler = new CustomerPackages();

        return $customerPackagesHandler->getShopPackages($idCommercialLead, $idCustomer);
    }

    public function getSuppliers(){
        $supplierBidsHandler = new SupplierBids;

        return $supplierBidsHandler->getSuppliers();
    }

    public function getProducts($idSupplier){
        $supplierBidsHandler = new SupplierBids;

        return $supplierBidsHandler->getProducts($idSupplier);
    }

    public function addSupplierBid($supplierBid){
        $supplierBidsHandler = new SupplierBids;

        return $supplierBidsHandler->addSupplierBid($supplierBid);
    }

    public function getUnlinkedSupplierBids(){
        $supplierBidsHandler = new SupplierBids;

        return $supplierBidsHandler->getUnlinkedSupplierBids();
    }

    public function addBid($bid){
        $bidsHandler = new Bids();

        return $bidsHandler->addBid($bid);
    }

    public function addBidMargin($idBid, $bidMargin){
        $bidMarginHandler = new BidMargin();

        return $bidMarginHandler->addBidMargin($idBid, $bidMargin);
    }
}
