<?php

namespace Ecomnova;

class PageClassFactory extends EcomnovaAbstract implements PageClassFactoryInterface
{
    public static function getProductPageInstance($site): ProductPageInterface
    {
        switch ($site) {
            case self::WEBSITE_BG:
                return new ProductPageBlossomingGifts();
            case self::WEBSITE_AY_DESKTOP:
                return new ProductPageAppleyardDesktop();
            case self::WEBSITE_AY_MOBILE:
                return new ProductPageAppleyardMobile();
            default:
                throw new \Exception('Site not supported');
        }
    }

    public static function createCategoryPageInstance($site): CategoryPageInterface
    {
        switch ($site) {
            case self::WEBSITE_BG:
                throw new \Exception('Category page not implemented for Blossoming Gifts');
            case self::WEBSITE_AY_DESKTOP:
                return new CategoryPageAppleyardDesktop();
            case self::WEBSITE_AY_MOBILE:
                throw new \Exception('Category page not implemented for Appleyard Mobile');
            default:
                throw new \Exception('Site not supported');
        }
    }

    public static function createCartPageInstance($site): CartPageInterface
    {
        switch ($site) {
            case self::WEBSITE_BG:
                throw new \Exception('Cart page not implemented for Blossoming Gifts');
            case self::WEBSITE_AY_DESKTOP:
                return new CartPageAppleyardDesktop();
            case self::WEBSITE_AY_MOBILE:
                throw new \Exception('Cart page not implemented for Appleyard Mobile');
            default:
                throw new \Exception('Site not supported');
        }
    }
}
