package Iodef::Pb::Format::Bindzone;
use base 'Iodef::Pb::Format';

use strict;
use warnings;

use constant DEFAULT_OUTPUT => '/etc/namedb/';

sub write_out {
    my $self = shift;
    my $args = shift;
        
    my $feed = $args->{'data'};
    my $array = $self->SUPER::to_keypair($args->{'data'});
    
    my $output = $self->get_config->{'bindzone_path'} || DEFAULT_OUTPUT();
    
    my $text = '// generated by: '.$0." at ".time()."\n";
    foreach (@$array){
        $text .= 'zone "'.$_->{'address'}.'" {type master; file "'.$output.'";};'."\n";
    }
    return $text;
    
}
1;
