<?php

namespace MGModule\DNSManager2\mgLibs\custom\dns\submodules\RCodeZero\Adapters;

use MGModule\DNSManager2\mgLibs\custom\dns\record\type\NS;
use MGModule\DNSManager2\mgLibs\custom\helpers\IdnaHelper;

class NSAdapter extends AbstractRCodeZeroAdapter
{
    /**
     * @param string $content
     */
    public function createRdata( $content )
    {
        $this->rdata = new NS();
        $this->rdata->nsdname = $this->contentToRelative($content);
    }

    /**
     * @param NS $rdata
     * @return string
     */
    public function parseContentToApiFormat( $rdata )
    {
        return $this->contentToAbsolute(IdnaHelper::idnaEncode($rdata->nsdname));
    }

}