# Class Person

Namespace
  adas_core.Domain.Models

Assembly
  adas-core.Domain.dll

Represents a person, providing type-specific equality comparison between instances.

    public class Person : IEquatable<Person>

Inheritance
  object
  Person

Implements
  IEquatable<Person>

Inherited Members
  object.Equals(object)
  object.Equals(object, object)
  object.GetHashCode()
  object.GetType()
  object.MemberwiseClone()
  object.ReferenceEquals(object, object)

Extension Methods
  NumberUtils.IsNumber(object)
  NumberUtils.ToDouble(object)
  ObjectUtils.ToStr(object?)

## Remarks

Implements IEquatable<T> to define a strongly typed Equals(T)"/> method for comparing Person objects.

## Properties

### BirthDate

    public DateTime? BirthDate { get; set; }

#### Property Value

DateTime?

### FirstName

    public string? FirstName { get; set; }

#### Property Value

string

### Gender

    public PatientEnum.Gender Gender { get; set; }

#### Property Value

PatientEnum.Gender

### HistoricalIds

    public List<HistoricalId>? HistoricalIds { get; set; }

#### Property Value

List<HistoricalId>

### Ids

    public Dictionary<string, string>? Ids { get; set; }

#### Property Value

Dictionary<string, string>

### Language

    public string? Language { get; set; }

#### Property Value

string

### LastName

    public string? LastName { get; set; }

#### Property Value

string

### SecondName

    public string? SecondName { get; set; }

#### Property Value

string

## Methods

### Equals(Person?)

Determines whether the current Person instance is equal to another Person by comparing their last name, first name, second name, birth date, language, gender, and identifiers. Returns `false` when the specified other person is `null`.

    public bool Equals(Person? other)

#### Parameters

`other` Person

  The Person to compare with the current instance.

#### Returns

bool

  `true` if all compared personal attributes and identifiers match; otherwise, `false`.

### IsEmpty()

Determines whether the patient instance contains no meaningful data by checking that the last name, first name, second name, and birth date are unset, the gender is unknown, and the identifiers collection is null or empty.

    public bool IsEmpty()

#### Returns

bool

  `true` if all relevant patient fields are null, empty, or set to their default unknown value; otherwise, `false`.

### IsEmptyDontCheckIds()

Determines whether the patient record contains no personal information, ignoring identification fields. Returns true only when all personal data fields (last name, first name, second name, birth date) are null or empty and the gender is set to Unknown.

    public bool IsEmptyDontCheckIds()

#### Returns

bool

  `true` if the patient's personal data fields are empty and gender is unknown; otherwise, `false`.

### SetIds(Dictionary<string, string>, DateTime?)

Sets the current patient identifiers and records them in the historical identifier list. If a historical entry already exists for the target time, the provided identifiers are merged into it; otherwise a new entry is created. When `time` is `null`, the current UTC date and time is used, and the historical list is lazily initialized if needed.

    public void SetIds(Dictionary<string, string> patientIds, DateTime? time = null)

#### Parameters

`patientIds` Dictionary<string, string>

  The dictionary of patient identifiers to assign as the current identifiers and to record historically.

`time` DateTime?

  The optional timestamp for the historical entry. If `null`, UtcNow is used.

### ToString()

Returns a string representation of the Person, including the non-empty/non-null properties such as first name, last name, second name, birth date, language, gender, and identifiers.

    public override string ToString()

#### Returns

string

  A formatted string in the form "Person[prop1: value1, prop2: value2, ...]" containing the person's populated fields.