<?php

namespace MGModule\DNSManager2\mgLibs\custom\dns\dnssec;

/**
 * 
 */
class DnsSec
{
    /**
     *
     * @var MGModule\DNSManager2\mgLibs\custom\dns\dnssec\ZSK
     */
    protected $zsk  =   array();
    
    /**
     *
     * @var MGModule\DNSManager2\mgLibs\custom\dns\dnssec\KSK
     */
    protected $ksk  =   array();
    
    /**
     *
     * @var MGModule\DNSManager2\mgLibs\custom\dns\dnssec\CSK
     */
    protected $csk  =   array();
    
    /**
     *
     * @var MGModule\DNSManager2\mgLibs\custom\dns\dnssec\DS 
     */
    protected $ds   =   array();
    
    function getZsk() {
        return $this->zsk;
    }

    function getKsk() {
        return $this->ksk;
    }

    function getCsk() {
        return $this->csk;
    }
    
    function getDs() {
        return $this->ds;
    }
    
    public function addKey($key)
    {
        if($key instanceof \MGModule\DNSManager2\mgLibs\custom\dns\dnssec\ZSK)
        { 
            $this->addZsk($key);
        }
        elseif($key instanceof \MGModule\DNSManager2\mgLibs\custom\dns\dnssec\KSK)
        {
            $this->addKsk($key);
        }
        elseif($key instanceof \MGModule\DNSManager2\mgLibs\custom\dns\dnssec\CSK)
        {
            $this->addCsk($key);
        }
    }
    
    function addZsk(\MGModule\DNSManager2\mgLibs\custom\dns\dnssec\ZSK $zsk) {
        $this->zsk[] = $zsk;
    }

    function addKsk(\MGModule\DNSManager2\mgLibs\custom\dns\dnssec\KSK $ksk) {
        $this->ksk[] = $ksk;
    }
    
    function addCsk(\MGModule\DNSManager2\mgLibs\custom\dns\dnssec\CSK $csk) {
        $this->csk[] = $csk;
    }
    
    function addDs(\MGModule\DNSManager2\mgLibs\custom\dns\record\type\DS $ds) {
        $this->ds[] = $ds;
    }
    
    public function hasKeys()
    {
        return !empty($this->zsk) || !empty($this->ksk) || !empty($this->csk) || !empty($this->ds);
    }
}