summaryrefslogtreecommitdiff
path: root/FS/FS/part_pkg_fcc_option.pm
blob: 3d821f502d07129337ccf62a0fa49dde7d5221d0 (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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
package FS::part_pkg_fcc_option;

use strict;
use base qw( FS::Record );
use FS::Record qw( qsearch qsearchs );
use Storable qw(dclone);
use Tie::IxHash;

sub table { 'part_pkg_fcc_option'; }

=head1 NAME

FS::part_pkg_fcc_option - Object methods for part_pkg_fcc_option records

=head1 SYNOPSIS

  use FS::part_pkg_fcc_option;

  $record = new FS::part_pkg_fcc_option \%hash;
  $record = new FS::part_pkg_fcc_option { 'column' => 'value' };

  $error = $record->insert;

  $error = $new_record->replace($old_record);

  $error = $record->delete;

  $error = $record->check;

=head1 DESCRIPTION

An FS::part_pkg_fcc_option object represents an option that classifies a
package definition on the FCC Form 477 report.  FS::part_pkg_fcc_option 
inherits from FS::Record.  The following fields are currently supported:

=over 4

=item num

primary key

=item fccoptionname

A string identifying a report option, as an element of a static data
structure found within this module.  See the C<part> method.

=item pkgpart

L<FS::part_pkg> foreign key.

=item optionvalue

The value of the report option, as an integer.  Boolean options use 1 
and NULL.  Most other options have some kind of lookup table.

=back

=head1 METHODS

=over 4

=item check

Checks all fields to make sure this is a valid FCC option.  If there is
an error, returns the error, otherwise returns false.  Called by the insert
and replace methods.

=cut

sub check {
  my $self = shift;

  my $error = 
    $self->ut_numbern('num')
    || $self->ut_alpha('fccoptionname')
    || $self->ut_number('pkgpart')
    || $self->ut_foreign_key('pkgpart', 'part_pkg', 'pkgpart')
    || $self->ut_textn('optionvalue')
  ;
  return $error if $error;

  $self->SUPER::check;
}

=back

=head1 CLASS METHODS

=over 4

=item media_types

Returns a Tie::IxHash hashref of the media type strings (which are not 
part of the report definition, per se) to arrayrefs of the technology 
codes included in each one.

=item technology_labels

Returns a hashref relating each technology code to a label.  Unlike the 
media type strings, the technology codes are part of the formal report
definition.

=cut

tie our %media_types, 'Tie::IxHash', (
  'Copper'          => [ 11, 12, 10, 20, 30 ],
  'Cable Modem'     => [ 41, 42, 40 ],
  'Fiber'           => [ 50 ],
  'Satellite'       => [ 60 ],
  'Fixed Wireless'  => [ 70 ],
  'Mobile Wireless' => [ 80, 81, 82, 83, 84, 85, 86, 87, 88 ],
  'Other'           => [ 90, 0 ],
);

tie our %technology_labels, 'Tie::IxHash',  (
  10 => 'Other ADSL',
  11 => 'ADSL2',
  12 => 'VDSL',
  20 => 'SDSL',
  30 => 'Other Copper Wireline',
  40 => 'Other Cable Modem',
  41 => 'Cable - DOCSIS 1, 1.1, 2.0',
  42 => 'Cable - DOCSIS 3.0',
  50 => 'Fiber',
  60 => 'Satellite',
  70 => 'Terrestrial Fixed Wireless',
  # mobile wireless
  80 => 'Mobile - WCDMA/UMTS/HSPA',
  81 => 'Mobile - HSPA+',
  82 => 'Mobile - EVDO/EVDO Rev A',
  83 => 'Mobile - LTE',
  84 => 'Mobile - WiMAX',
  85 => 'Mobile - CDMA',
  86 => 'Mobile - GSM',
  87 => 'Mobile - Analog',
  88 => 'Other Mobile',

  90 => 'Electric Power Line',
  0  => 'Other'
);

tie our %spectrum_labels, 'Tie::IxHash', (
  90 => '700 MHz Band',
  91 => 'Cellular Band',
  92 => 'Specialized Mobile Radio (SMR) Band',
  93 => 'Advanced Wireless Services (AWS) 1 Band',
  94 => 'Broadband Personal Communications Service (PCS) Band',
  95 => 'Wireless Communications Service (WCS) Band',
  96 => 'Broadband Radio Service/Educational Broadband Service Band',
  97 => 'Satellite (e.g. L-band, Big LEO, Little LEO)',
  98 => 'Unlicensed (including broadcast television "white spaces") Bands',
  99 => '600 MHz',
  100 => 'H Block',
  101 => 'Advanced Wireless Services (AWS) 3 Band',
  102 => 'Advanced Wireless Services (AWS) 4 Band',
  103 => 'Other',
);

sub media_types {
  Storable::dclone(\%media_types);
}

sub technology_labels {
  Storable::dclone(\%technology_labels);
}

sub spectrum_labels {
  Storable::dclone(\%spectrum_labels);
}

=head1 BUGS

=head1 SEE ALSO

L<FS::Record>, schema.html from the base documentation.

=cut

1;