<?php

declare(strict_types=1);

namespace BookiFlex\Extensions\NotificationPreview\Repository;

use BookiFlex\Core\Contract\AccommodationType\AccommodationTypeRepositoryInterface;
use BookiFlex\Core\Model\AccommodationType\Accommodation\AccommodationCapacity;
use BookiFlex\Core\Model\AccommodationType\Accommodation\AccommodationType;
use BookiFlex\Core\Model\AccommodationType\BookingUnitTypeInterface;
use BookiFlex\Core\Model\AccommodationType\Guest\AdultGuest;
use BookiFlex\Core\Model\AccommodationType\Placement\PlacementOption;
use BookiFlex\Core\Model\AccommodationType\Placement\PlacementRules;
use BookiFlex\Core\ValueObject\PlacementLocation;

defined( 'ABSPATH' ) || exit;

class FakeAccommodationTypeRepository implements AccommodationTypeRepositoryInterface
{
    public function findOne(array $scope = []): ?object
    {
        return $this->getAccommodationType();
    }

    public function findByPK(mixed $id): ?object
    {
        return $this->getAccommodationType();
    }

    public function findAll(array $scope = []): iterable
    {
        return [$this->getAccommodationType()];
    }

    private function getAccommodationType(): AccommodationType
    {
        $placementRules = new PlacementRules();
        $placementRules->addOption(new PlacementOption(new AdultGuest(1), PlacementLocation::main()));
        $placementRules->addOption(new PlacementOption(new AdultGuest(2), PlacementLocation::main()));

        return new AccommodationType(
            1,
            'Standard Aurora Room',
            BookingUnitTypeInterface::ROOM_ACCOMMODATION,
            new AccommodationCapacity(2, 0),
            $placementRules,
            2,
            ['shortCode' => 'AUR', 'livingSpace' => '15', 'contactInfo' => []],
        );
    }
}