<?php

namespace DropshippingExportFreeVendor\WPDesk\Library\DropshippingExport\Service\Writer\XML;

use DropshippingExportFreeVendor\WPDesk\Library\DropshippingExport\Service\Writer\Generator;
use DOMElement;
use DOMDocument;
use DropshippingExportFreeVendor\WPDesk\Library\DropshippingExport\ProductFields\Collection\ProductFieldCollection;
class CeneoXmlWriter extends AbstractBatchXmlWriter implements Generator
{
    const PRODUCT_ITEMS = 'offers';
    const PRODUCT_ITEM = 'o';
    public static function get_supported_extension(): string
    {
        return 'XML';
    }
    /**
     * Get the tag name for a single product item.
     */
    protected function get_product_item_tag(): string
    {
        return self::PRODUCT_ITEM;
    }
    /**
     * Get the tag name for the products container.
     */
    protected function get_product_items_tag(): string
    {
        return self::PRODUCT_ITEMS;
    }
    /**
     * Prepare the root XML element.
     */
    protected function prepare_root_element(): DOMElement
    {
        $xml_document = new \DOMDocument('1.0', 'UTF-8');
        $xml_document->formatOutput = \true;
        $xml_document->preserveWhiteSpace = \false;
        $root_element = $xml_document->createElement(self::PRODUCT_ITEMS);
        $root_element->setAttribute('xmlns:xsi', 'http://www.w3.org/2001/XMLSchema-instance');
        $root_element->setAttribute('version', '1');
        $xml_document->appendChild($root_element);
        return $root_element;
    }
}
