<?php

namespace WP_Statistics\Service\Admin\PrivacyAudit\Audits;

use WP_Statistics\Components\View;
use WP_STATISTICS\Option;
use WP_Statistics\Service\Admin\PrivacyAudit\Audits\Abstracts\RecommendedAudit;
use WP_Statistics\Service\Admin\PrivacyAudit\Faqs\RequireConsent;

class RecommendConsent extends RecommendedAudit
{
    public static function getStatus()
    {
        $consentIntegration = Option::get('consent_integration');
        $consentStatus      = RequireConsent::getStatus();

        if (!empty($consentIntegration)) {
            return 'passed';
        }

        return ($consentStatus === 'warning') ? 'action_required' : 'recommended';
    }

    public static function getPassedStateInfo()
    {
        return [
            'icon'  => '<svg width="28" height="28" viewBox="0 0 28 28" fill="none" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"><rect x="0.5" width="27" height="28" fill="url(#pattern0_19258_212788)"></rect><defs><pattern id="pattern0_19258_212788" patternContentUnits="objectBoundingBox" width="1" height="1"><use xlink:href="#image0_19258_212788" transform="matrix(0.00566687 0 0 0.00546448 -0.00435135 0)"></use></pattern><image id="image0_19258_212788" width="178" height="183" xlink:href="data:image/png;base64,[encoded data, 17604 characters]"></image></defs></svg>',
            'title' => esc_html__('Consent Plugin Successfully Integrated', 'wp-statistics'),
            'notes' => View::load('components/privacy-audit/recommend-consent', [], true),
        ];
    }

    public static function getUnpassedStateInfo()
    {
        return [
            'icon'  => '<svg width="28" height="28" viewBox="0 0 28 28" fill="none" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"><rect x="0.5" width="27" height="28" fill="url(#pattern0_19258_212788)"></rect><defs><pattern id="pattern0_19258_212788" patternContentUnits="objectBoundingBox" width="1" height="1"><use xlink:href="#image0_19258_212788" transform="matrix(0.00566687 0 0 0.00546448 -0.00435135 0)"></use></pattern><image id="image0_19258_212788" width="178" height="183" xlink:href="data:image/png;base64,[encoded data, 17604 characters]"></image></defs></svg>',
            'title' => esc_html__('Consent Plugin Required for Privacy Compliance', 'wp-statistics'),
            'notes' => View::load('components/privacy-audit/recommend-consent-unpassed', [], true),
        ];
    }

    public static function getRecommendedStateInfo()
    {
        return [
            'icon'  => '<svg width="28" height="28" viewBox="0 0 28 28" fill="none" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"><rect x="0.5" width="27" height="28" fill="url(#pattern0_19258_212788)"></rect><defs><pattern id="pattern0_19258_212788" patternContentUnits="objectBoundingBox" width="1" height="1"><use xlink:href="#image0_19258_212788" transform="matrix(0.00566687 0 0 0.00546448 -0.00435135 0)"></use></pattern><image id="image0_19258_212788" width="178" height="183" xlink:href="data:image/png;base64,[encoded data, 17604 characters]"></image></defs></svg>',
            'title' => esc_html__('Respect Visitor Privacy with Consent Plugins', 'wp-statistics'),
            'notes' => View::load('components/privacy-audit/recommend-consent-info', [], true),
        ];
    }
}