import {
  IsString
} from "class-validator";

/**
 * Defines the Address class.
 * Implemented this way to prevent any formatting differences.
*/
export class Address {
  /**
   * The address's first line.
   * Containing the street and house number.
   */
  @IsString()
  address1?: string;

  /**
   * The address's second line.
   * Containing optional information.
   */
  @IsString()
  address2?: string;

  /**
   * The address's postal code.
   * This will get checked against the postal code syntax for the configured country.
   */
  @IsString()
  postalcode: string;

  /**
   * The address's city.
   */
  @IsString()
  city: string;

  /**
   * The address's country.
   */
  @IsString()
  country: string;

  public reset() {
    this.address1 = null;
    this.address2 = null;
    this.city = null;
    this.country = null;
    this.postalcode = null;
  }
}
