export interface EventPropertiesData {
  os?: string;
  osVersion?: string;
  appVersion?: string;
  networkType?: string;
  clientTs?: number;
  province?: string;
  city?: string;
  [key: string]: unknown;
}

export class EventProperties {
  private readonly _data: EventPropertiesData;

  private constructor(data: EventPropertiesData) {
    this._data = { ...data };
  }

  get data(): EventPropertiesData {
    return { ...this._data };
  }

  get os(): string | undefined {
    return this._data.os;
  }

  get osVersion(): string | undefined {
    return this._data.osVersion;
  }

  get appVersion(): string | undefined {
    return this._data.appVersion;
  }

  get networkType(): string | undefined {
    return this._data.networkType;
  }

  get clientTs(): number | undefined {
    return this._data.clientTs;
  }

  get province(): string | undefined {
    return this._data.province;
  }

  get city(): string | undefined {
    return this._data.city;
  }

  static empty(): EventProperties {
    return new EventProperties({});
  }

  static fromData(data: EventPropertiesData): EventProperties {
    return new EventProperties(data);
  }

  toJSON(): EventPropertiesData {
    return this._data;
  }
}
