export class Guid {
    constructor(guid) {
        this.guid = guid;
    }
    static newGuid() {
        let result;
        let i;
        let j;
        result = '';
        for (j = 0; j < 32; j++) {
            if (j === 8 || j === 12 || j === 16 || j === 20) {
                result = result + '-';
            }
            i = Math.floor(Math.random() * 16).toString(16).toUpperCase();
            result = result + i;
        }
        return new Guid(result);
    }
    toString(format) {
        if (format && 'n' === format.toLowerCase()) {
            return this.guid.replace(/-/g, '');
        }
        else {
            return this.guid;
        }
    }
}
