NAME
    Data::Person - Data object for person.

SYNOPSIS
     use Data::Person;

     my $obj = Data::Person->new(%params);
     my $email = $obj->email;
     my $external_ids_ar = $obj->external_ids;
     my $id = $obj->id;
     my $name = $obj->name;
     my $sex = $obj->sex;

DESCRIPTION
    The immutable data object for representation of person.

METHODS
  "new"
     my $obj = Data::Person->new(%params);

    Constructor.

    Returns instance of object.

    *       "email"

            Person's email for external identification. It's optional.
            Default value is undef.

    *       "external_ids"

            Person external ids. It's optional. Value must be a instance of
            Data::ExternalId object. Default value is [].

    *       "id"

            Id of person. It's natural number. It's optional. Default value
            is undef.

    *       "name"

            Name of person. Length of name is 255. It's optional.

    *       "sex"

            Sex of person. Possible values are: female, male and unknown.
            It's optional.

  "email"
     my $email = $obj->email;

    Get person email.

    Returns string.

  "external_ids"
     my $external_ids_ar = $obj->external_ids;

    Get external ids.

    Returns reference to array with Data::ExternalId instances.

  "id"
     my $id = $obj->id;

    Get person id.

    Returns number.

  "name"
     my $name = $obj->name;

    Get person name.

    Returns string.

  "sex"
     my $sex = $obj->sex;

    Get person sex.

    Returns string.

ERRORS
     new():
             From Mo::utils::check_array_object():
                     Parameter 'external_ids' must be a array.
                             Value: %s
                             Reference: %s
                     External id isn't 'Data::ExternalId' object.
                             Value: %s
                             Reference: %s
             From Mo::utils::Number::check_positive_natural():
                     Parameter 'id' must a positive natural number.
                             Value: %s
             Parameter 'name' has length greater than '255'.
                     Value: %s
             Parameter 'sex' must be one of defined strings.
                     String: %s
                     Possible strings: %s

EXAMPLE
     use strict;
     use warnings;

     use Data::ExternalId;
     use Data::Person;
     use DateTime;
     use Unicode::UTF8 qw(decode_utf8 encode_utf8);

     my $obj = Data::Person->new(
             'email' => 'skim@cpan.org',
             'external_ids' => [
                     Data::ExternalId->new(
                             'key' => 'Wikidata',
                             'value' => 'Q27954834',
                     ),
             ],
             'id' => 1,
             'name' => decode_utf8('Michal Josef Špaček'),
             'sex' => 'male',
     );

     # Print out.
     print 'Id: '.$obj->id."\n";
     print 'Name: '.encode_utf8($obj->name)."\n";
     print 'Email: '.$obj->email."\n";
     print 'Sex: '.$obj->sex."\n";
     foreach my $external_id (@{$obj->external_ids}) {
            print 'External id - '.$external_id->key.': '.$external_id->value."\n";
     }

     # Output:
     # Id: 1
     # Name: Michal Josef Špaček
     # Email: skim@cpan.org
     # Sex: male
     # External id - Wikidata: Q27954834

DEPENDENCIES
    Mo, Mo::utils, Mo::utils::Email, Mo::utils::Number, Readonly.

REPOSITORY
    <https://github.com/michal-josef-spacek/Data-Person>

AUTHOR
    Michal Josef Špaček <mailto:skim@cpan.org>

    <http://skim.cz>

LICENSE AND COPYRIGHT
    © 2021-2025 Michal Josef Špaček

    BSD 2-Clause License

VERSION
    0.05

