<?php
/**
 * @package   Essentials YOOtheme Pro 2.2.16 build 0813.1608
 * @author    ZOOlanders https://www.zoolanders.com
 * @copyright Copyright (C) Joolanders, SL
 * @license   http://www.gnu.org/licenses/gpl.html GNU/GPL
 */

namespace ZOOlanders\YOOessentials\Source\Provider\Facebook\Type;

use ZOOlanders\YOOessentials\Source\GraphQL\TypeInterface;

class FacebookReviewType implements TypeInterface
{
    public const TYPE_NAME = 'FacebookReview';
    public const TYPE_LABEL = 'Facebook Review';

    public function type(): string
    {
        return TypeInterface::TYPE_OBJECT;
    }

    public function name(): string
    {
        return self::TYPE_NAME;
    }

    public function label(): string
    {
        return self::TYPE_LABEL;
    }

    public function config(): array
    {
        return [
            'fields' => [
                'review_text' => [
                    'type' => 'String',
                    'metadata' => [
                        'label' => 'Text',
                        'filters' => ['limit'],
                    ],
                ],
                'rating' => [
                    'type' => 'Int',
                    'metadata' => [
                        'label' => 'Rating',
                    ],
                ],
                'recommendation_type' => [
                    'type' => 'String',
                    'metadata' => [
                        'label' => 'Type',
                    ],
                ],
                'created_time' => [
                    'type' => 'String',
                    'metadata' => [
                        'label' => 'Created At',
                        'filters' => ['date'],
                    ],
                ],
                'has_rating' => [
                    'type' => 'Boolean',
                    'metadata' => [
                        'label' => 'Has Rating',
                    ],
                ],
                'has_review' => [
                    'type' => 'Boolean',
                    'metadata' => [
                        'label' => 'Has Review',
                    ]
                ],
                'reviewer' => [
                    'type' => FacebookUserType::TYPE_NAME,
                    'metadata' => [
                        'label' => 'Reviewer',
                    ],
                ],
            ],

            'metadata' => [
                'type' => true,
                'label' => $this->label(),
            ],
        ];
    }
}
