<?php


namespace Lc\CaracoleBundle\Solver\PointSale;


use Lc\CaracoleBundle\Model\PointSale\PointSaleInterface;

class PointSaleSolver
{

    public function labelAdminChoice(PointSaleInterface $pointSale): string
    {
        if ($pointSale->getIsPublic()) {
            return '[Public] ' . $pointSale->getTitle();
        } else {
            return '[Privée] ' . $pointSale->getTitle();
        }
    }

    public function getSummary(PointSaleInterface $pointSale): string
    {
        $html = '';

        if ($pointSale->getTitle()) {
            $html .= $pointSale->getTitle() . '<br />';
        }

        if ($pointSale->getAddress()) {
            $html .= $pointSale->getAddress()->getAddress() . '<br />';
        }

        if ($pointSale->getAddress()->getZip() || $pointSale->getAddress()->getCity()) {
            $html .= $pointSale->getAddress()->getZip() . ' ' . $pointSale->getAddress()->getCity() . '<br />';
        }

        return $html;
    }
}