/*
 * Copyright 2015-2017 Atomist Inc.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

import * as fingerprintApi from "../Fingerprint";
import { Commit } from "./Commit";
export { Fingerprint };

/**
 * Type Fingerprint
 * Generated class exposing Atomist Cortex.
 * Fluent builder style class for use in testing and query by example.
 */
class Fingerprint implements fingerprintApi.Fingerprint {

    private _commit: Commit;
    private _data: string;
    private _name: string;
    private _sha: string;

    private _nodeName = "Fingerprint";
    private _nodeTags = [ "Fingerprint", "-dynamic" ];

    /**
     * Implementation of GraphNode interface method.
     * For infrastructure, not user use
     */
    public nodeName(): string {
        return this._nodeName;
    }

    /**
     * Implementation of GraphNode interface method.
     * For infrastructure, not user use
     */
    public nodeTags(): string[] {
        return this._nodeTags;
    }

    /**
     * commit - Fingerprint -> Commit
     *
     * @property {Commit} commit
     */
    get commit(): Commit {
        if (this._commit === undefined) {
            throw new Error(`Please use the relevant builder method to set property [commit] on stub ` +
                `[Fingerprint] before accessing it. It's probably called [withCommit]`);
        }
        return this._commit;
    }

    /**
     * Fluent builder method to set the commit property
     */
    public withCommit(commit_: Commit) {
        this._commit = commit_;
        return this;
    }

    /**
     * data
     *
     * @property {string} data
     */
    get data(): string {
        if (this._data === undefined) {
            throw new Error(`Please use the relevant builder method to set property [data] on stub ` +
                `[Fingerprint] before accessing it. It's probably called [withData]`);
        }
        return this._data;
    }

    /**
     * Fluent builder method to set the data property
     */
    public withData(data_: string) {
        this._data = data_;
        return this;
    }

    /**
     * name
     *
     * @property {string} name
     */
    get name(): string {
        if (this._name === undefined) {
            throw new Error(`Please use the relevant builder method to set property [name] on stub ` +
                `[Fingerprint] before accessing it. It's probably called [withName]`);
        }
        return this._name;
    }

    /**
     * Fluent builder method to set the name property
     */
    public withName(name_: string) {
        this._name = name_;
        return this;
    }

    /**
     * sha
     *
     * @property {string} sha
     */
    get sha(): string {
        if (this._sha === undefined) {
            throw new Error(`Please use the relevant builder method to set property [sha] on stub ` +
                `[Fingerprint] before accessing it. It's probably called [withSha]`);
        }
        return this._sha;
    }

    /**
     * Fluent builder method to set the sha property
     */
    public withSha(sha_: string) {
        this._sha = sha_;
        return this;
    }

}
