aboutsummaryrefslogtreecommitdiffstats
path: root/perllib/FixMyStreet/SendReport.pm
blob: 9ba5078622363d1525bcbe8b7e06570877b7cf38 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
package FixMyStreet::SendReport;

use Moose;

use Module::Pluggable
    sub_name    => 'senders',
    search_path => __PACKAGE__,
    require     => 1;

has 'councils' => ( is => 'rw', isa => 'HashRef', default => sub { {} } );
has 'to' => ( is => 'rw', isa => 'ArrayRef', default => sub { [] } );
has 'success' => ( is => 'rw', isa => 'Bool', default => 0 );
has 'error' => ( is => 'rw', isa => 'Str', default => '' );
has 'skipped' => ( 'is' => 'rw', isa => 'Str', default => '' );
has 'unconfirmed_counts' => ( 'is' => 'rw', isa => 'HashRef', default => sub { {} } );
has 'unconfirmed_notes' => ( 'is' => 'rw', isa => 'HashRef', default => sub { {} } );


sub should_skip {
    return 0;
}

sub get_senders {
    my $self = shift;

    my %senders = map { $_ => 1 } $self->senders;

    return \%senders;
}

sub reset {
    my $self = shift;

    $self->councils( {} );
    $self->to( [] );
}

sub add_council {
    my $self = shift;
    my $council = shift;
    my $info = shift;
    my $config = shift;

    $self->councils->{ $council } = { info => $info, config => $config };
}


1;