aboutsummaryrefslogtreecommitdiff
path: root/src/fields/DocumentReference.ts
blob: 10dac9f92f474e8eeeed657e0b8c9dba3472f249 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
import { Field, Opt } from "./Field";
import { Document } from "./Document";
import { Key } from "./Key";

export class DocumentReference extends Field {
    get Key(): Key {
        return this.key;
    }

    get Document(): Document {
        return this.document;
    }

    constructor(private document: Document, private key: Key) {
        super();
    }

    Dereference(): Opt<Field> {
        return this.document.Get(this.key);
    }

    DereferenceToRoot(): Opt<Field> {
        let field: Opt<Field> = this;
        while (field instanceof DocumentReference) {
            field = field.Dereference();
        }
        return field;
    }

    TrySetValue(value: any): boolean {
        throw new Error("Method not implemented.");
    }
    GetValue() {
        throw new Error("Method not implemented.");
    }
    Copy(): Field {
        throw new Error("Method not implemented.");
    }


}