package Mail::DMARC::Report::Aggregate::Record;
our $VERSION = '2.20260827';
use strict;
use warnings;
use feature 'signatures';

use Carp;

use parent 'Mail::DMARC::Base';
require Mail::DMARC::Report::Aggregate::Record::Identifiers;
require Mail::DMARC::Report::Aggregate::Record::Auth_Results;
require Mail::DMARC::Report::Aggregate::Record::Row;

sub new( $class, @args ) {
    croak "invalid arguments" if @args % 2;

    my $self = bless {}, $class;
    return $self if !@args;

    my %args = @args;
    foreach my $key ( keys %args ) {
        $self->$key( $args{$key} );
    }

    return $self;
}

sub identifiers( $self, @args ) {

    if ( !@args ) {
        return $self->{identifiers} if $self->{identifiers};
    }

    if ( 'HASH' eq ref $args[0] ) {
        @args = %{ $args[0] };
    }

    return $self->{identifiers}
        = Mail::DMARC::Report::Aggregate::Record::Identifiers->new(@args);
}

sub auth_results( $self, @args ) {

    if ( !@args ) {
        return $self->{auth_results} if $self->{auth_results};
    }

    if ( @args == 1 && 'HASH' eq ref $args[0] ) {
        @args = %{ $args[0] };
    }

    return $self->{auth_results}
        = Mail::DMARC::Report::Aggregate::Record::Auth_Results->new(@args);
}

sub row( $self, @args ) {

    if ( !@args ) {
        return $self->{row} if $self->{row};
    }

    if ( @args == 1 && 'HASH' eq ref $args[0] ) {
        @args = %{ $args[0] };
    }

    return $self->{row} = Mail::DMARC::Report::Aggregate::Record::Row->new(@args);
}

1;

__END__

=pod

=head1 NAME

Mail::DMARC::Report::Aggregate::Record - record section of aggregate report

=head1 VERSION

version 2.20260827

=head1 DESCRIPTION

An aggregate report record, with object methods for identifiers, auth_results, and each row.

=head1 AUTHORS

=over 4

=item *

Matt Simerson <msimerson@cpan.org>

=item *

Davide Migliavacca <shari@cpan.org>

=item *

Marc Bradshaw <marc@marcbradshaw.net>

=back

=head1 COPYRIGHT AND LICENSE

This software is copyright (c) 2026 by Matt Simerson.

This is free software; you can redistribute it and/or modify it under
the same terms as the Perl 5 programming language system itself.

=cut
