models/communities/ChatId.js

import UserId from './../UserId.js';

export default class ChatId {
    /**
     * Creates a ChatId.
     *
     * @constructor ChatId
     * @param {string} [id] - Chat ID
     * @param {UserId} [userId] - User ID
     */
    constructor(id, userId) {
        this.id = id || null;
        this.userId = userId || null;
    }

    /**
     * Create a new ChatId instance.
     *
     * @memberof ChatId
     * @param {string} id - Chat ID.
     * @return {ChatId} New ChatId.
     */
    static create(id) {
        return new ChatId(id);
    }

    /**
     * Create a new ChatId instance with user id.
     *
     * @memberof ChatId
     * @param {UserId} userId - User ID.
     * @return {ChatId} New ChatId.
     */
    static createWithUserId(userId) {
        return new ChatId(null, userId);
    }
}