# automatically generated file, don't edit



# Copyright 2011 David Cantrell, derived from data from libphonenumber
# http://code.google.com/p/libphonenumber/
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
package Number::Phone::StubCountry::NZ;
use base qw(Number::Phone::StubCountry);

use strict;
use warnings;
use utf8;
our $VERSION = 1.20181205223704;

my $formatters = [
                {
                  'format' => '$1-$2 $3',
                  'leading_digits' => '
            24|
            [346]|
            7[2-57-9]|
            9[2-9]
          ',
                  'national_rule' => '0$1',
                  'pattern' => '(\\d)(\\d{3})(\\d{4})'
                },
                {
                  'pattern' => '(\\d{3})(\\d{2})(\\d{3})',
                  'format' => '$1 $2 $3',
                  'leading_digits' => '
            80|
            9
          ',
                  'national_rule' => '0$1'
                },
                {
                  'leading_digits' => '
            2(?:
              10|
              74
            )|
            [59]|
            80
          ',
                  'format' => '$1 $2 $3',
                  'national_rule' => '0$1',
                  'pattern' => '(\\d{3})(\\d{3})(\\d{3,4})'
                },
                {
                  'pattern' => '(\\d{2})(\\d{3,4})(\\d{4})',
                  'national_rule' => '0$1',
                  'format' => '$1 $2 $3',
                  'leading_digits' => '2[028]'
                },
                {
                  'leading_digits' => '[278]',
                  'format' => '$1 $2 $3',
                  'national_rule' => '0$1',
                  'pattern' => '(\\d{2})(\\d{3})(\\d{3,5})'
                }
              ];

my $validators = {
                'pager' => '[28]6\\d{6,7}',
                'mobile' => '
          2(?:
            [0-28]\\d?|
            [79]
          )\\d{7}|
          21\\d{6}
        ',
                'voip' => '',
                'toll_free' => '
          508\\d{6,7}|
          80\\d{6,8}
        ',
                'geographic' => '
          (?:
            24099|
            (?:
              3[2-79]|
              [49][2-9]|
              6[235-9]|
              7[2-57-9]
            )\\d{3}
          )\\d{3}
        ',
                'fixed_line' => '
          (?:
            24099|
            (?:
              3[2-79]|
              [49][2-9]|
              6[235-9]|
              7[2-57-9]
            )\\d{3}
          )\\d{3}
        ',
                'specialrate' => '(90\\d{6,7})',
                'personal_number' => '70\\d{7}'
              };
my %areanames = (
  6424 => "Scott\ Base",
  64320 => "Gore\/Edendale",
  64321 => "Invercargill\/Stewart\ Island\/Rakiura",
  64322 => "Otautau",
  64323 => "Riverton\/Winton",
  64324 => "Tokanui\/Lumsden\/Te\ Anau",
  64325 => "South\ Island",
  64326 => "South\ Island",
  64327 => "South\ Island",
  64328 => "South\ Island",
  64329 => "South\ Island",
  64330 => "Ashburton\/Akaroa\/Chatham\ Islands",
  64331 => "Rangiora\/Amberley\/Culverden\/Darfield\/Cheviot\/Kaikoura",
  64332 => "Christchurch",
  64333 => "Christchurch",
  64334 => "Christchurch\/Rolleston",
  64335 => "Christchurch",
  64336 => "South\ Island",
  64337 => "Christchurch",
  64338 => "Christchurch",
  64339 => "South\ Island",
  64340 => "South\ Island",
  643409 => "Queenstown",
  64341 => "Balclutha\/Milton",
  64342 => "South\ Island",
  64343 => "Oamaru\/Mount\ Cook\/Twizel\/Kurow",
  64344 => "Queenstown\/Cromwell\/Alexandra\/Wanaka\/Ranfurly\/Roxburgh",
  64345 => "Dunedin\/Queenstown",
  64346 => "Dunedin\/Palmerston",
  64347 => "Dunedin",
  64348 => "Dunedin\/Lawrence\/Mosgiel",
  64349 => "South\ Island",
  6435 => "South\ Island",
  64352 => "Murchison\/Takaka\/Motueka",
  64354 => "Nelson",
  64357 => "Blenheim",
  6436 => "South\ Island",
  64361 => "Timaru",
  64368 => "Timaru\/Waimate\/Fairlie",
  64369 => "Geraldine",
  6437 => "South\ Island",
  64373 => "Greymouth",
  64375 => "Hokitika\/Franz\ Josef\ Glacier\/Fox\ Glacier\/Haast",
  64376 => "Greymouth",
  64378 => "Westport",
  64390 => "Ashburton",
  64391 => "South\ Island",
  64392 => "South\ Island",
  64393 => "South\ Island",
  64394 => "Christchurch\/Invercargill",
  64395 => "Dunedin\/Timaru",
  64396 => "Christchurch",
  64397 => "Christchurch",
  64398 => "Christchurch\/Blenheim\/Nelson",
  64399 => "South\ Island",
  64423 => "Wellington\/Porirua\/Tawa",
  64429 => "Paraparaumu",
  6443 => "Wellington",
  6444 => "Wellington",
  6445 => "Wellington\/Hutt\ Valley",
  64480 => "Wellington",
  6449 => "Wellington",
  64490 => "Paraparaumu",
  64627 => "Hawera",
  64630 => "Featherston",
  64632 => "Palmerston\ North\/Marton",
  64634 => "Wanganui",
  64635 => "Palmerston\ North\ City",
  64636 => "Levin",
  64637 => "Masterton\/Dannevirke\/Pahiatua",
  64638 => "Taihape\/Ohakune\/Waiouru",
  64675 => "New\ Plymouth\/Mokau",
  64676 => "New\ Plymouth\/Opunake\/Stratford",
  64683 => "Napier\/Wairoa",
  64684 => "Napier\ City",
  64685 => "Waipukurau",
  64686 => "Gisborne\/Ruatoria",
  64687 => "Napier\/Hastings",
  64694 => "Masterton\/Levin",
  64695 => "Palmerston\ North\/New\ Plymouth",
  64696 => "Wanganui\/New\ Plymouth",
  64697 => "Napier",
  64698 => "Gisborne",
  64730 => "Whakatane",
  64731 => "Whakatane\/Opotiki",
  64732 => "Whakatane",
  64733 => "Rotorua\/Taupo",
  64734 => "Rotorua",
  64735 => "Rotorua",
  64736 => "Rotorua",
  64737 => "Taupo",
  64738 => "Taupo",
  64754 => "Tauranga",
  64757 => "Tauranga",
  64782 => "Hamilton\/Huntly",
  64783 => "Hamilton",
  64784 => "Hamilton",
  64785 => "Hamilton",
  64786 => "Paeroa\/Waihi\/Thames\/Whangamata",
  64787 => "Te\ Awamutu\/Otorohanga\/Te\ Kuiti",
  64788 => "Matamata\/Putaruru\/Morrinsville",
  64789 => "Taumarunui",
  64790 => "Taupo",
  64792 => "Rotorua\/Whakatane\/Tauranga",
  64793 => "Tauranga",
  64795 => "Hamilton",
  64796 => "Hamilton",
  6492 => "Auckland",
  64923 => "Pukekohe",
  6493 => "Auckland\/Waiheke\ Island",
  64940 => "Kaikohe\/Kaitaia\/Kawakawa",
  64941 => "Auckland",
  64942 => "Helensville\/Warkworth\/Hibiscus\ Coast\/Great\ Barrier\ Island",
  64943 => "Whangarei\/Maungaturoto",
  64944 => "Auckland",
  64947 => "Auckland",
  64948 => "Auckland",
  6495 => "Auckland",
  6496 => "Auckland",
  6498 => "Auckland",
  6499 => "Auckland",
  64990 => "Warkworth",
  64998 => "Whangarei",
);
    sub new {
      my $class = shift;
      my $number = shift;
      $number =~ s/(^\+64|\D)//g;
      my $self = bless({ number => $number, formatters => $formatters, validators => $validators, areanames => \%areanames}, $class);
      return $self if ($self->is_valid());
      $number =~ s/^(?:0)//;
      $self = bless({ number => $number, formatters => $formatters, validators => $validators, areanames => \%areanames}, $class);
      return $self->is_valid() ? $self : undef;
    }
1;