/*
 * 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 userJoinedChannelApi from "../UserJoinedChannel";
import { ChatChannel } from "./ChatChannel";
import { ChatId } from "./ChatId";
export { UserJoinedChannel };

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

    private _channel: ChatChannel;
    private _user: ChatId;

    private _nodeName = "UserJoinedChannel";
    private _nodeTags = [ "UserJoinedChannel", "-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;
    }

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

    /**
     * Fluent builder method to set the channel property
     */
    public withChannel(channel_: ChatChannel) {
        this._channel = channel_;
        return this;
    }

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

    /**
     * Fluent builder method to set the user property
     */
    public withUser(user_: ChatId) {
        this._user = user_;
        return this;
    }

}
