package zello

import com.fasterxml.jackson.annotation.JsonPropertyOrder

@Suppress("unused")
@JsonPropertyOrder(value=["command","seq","auth_token","refresh_token","username","password","channels","listen_only","version","platform_type","platform_name"])
class LogonCommand(val seq: Int, val auth_token: String?, val refresh_token: String?, val username: String?, val password: String?, val channels: Array<String>, val listen_only: Boolean?, val version: String?, val platform_type: String?, val platform_name:String?) {
    val command: String = "logon"
    companion object {
        /**
         * Creates a LogonCommand with the specified sequence number and channels.
         * auth_token, refresh_token, username, password, listen_only, version, platform_type, platform_name are omitted
         * @param seq The sequence number for the command.
         * @param channels An array of channel names to log on to.
         * @return A new instance of LogonCommand.
         */
        fun create(seq: Int, channels: Array<String>): LogonCommand {
            return LogonCommand(seq, null, null, null, null, channels, null, null, null, null)
        }

        /**
         * Creates a LogonCommand with the specified sequence number, channels, and auth_token.
         * refresh_token, username, password, listen_only, version, platform_type, platform_name are omitted
         * @param seq The sequence number for the command.
         * @param channels An array of channel names to log on to.
         * @param auth_token API authentication token. If omitted refresh_token is required when connecting to consumer Zello
         *
         * See [Zello API](https://github.com/zelloptt/zello-channel-api/blob/master/API.md#authentication)
         * @return A new instance of LogonCommand.
         */
        fun create(seq: Int, channels: Array<String>, auth_token: String?): LogonCommand {
            return LogonCommand(seq, auth_token, null, null, null, channels, null, null, null, null)
        }

        /**
         * Creates a LogonCommand with the specified sequence number, channels, auth_token, username, and password.
         * refresh_token, listen_only, version, platform_type, platform_name are omitted
         * @param seq The sequence number for the command.
         * @param channels An array of channel names to log on to.
         * @param auth_token API authentication token. If omitted refresh_token is required when connecting to consumer Zello
         * @param username Username for authentication.
         * @param password Password for authentication.
         * @return A new instance of LogonCommand.
         */
        fun create(seq: Int, channels: Array<String>, auth_token: String?, username: String?, password: String?): LogonCommand {
            return LogonCommand(seq, auth_token, null, username, password, channels, null, null, null, null)
        }

        /**
         * Creates a LogonCommand with the specified sequence number, channels, auth_token, refresh_token, username, and password.
         * listen_only, version, platform_type, platform_name are omitted
         * @param seq The sequence number for the command.
         * @param channels An array of channel names to log on to.
         * @param auth_token API authentication token. If omitted refresh_token is required when connecting to consumer Zello
         * @param refresh_token API refresh token. If omitted auth_token  is required when connecting to consumer Zello.
         * @param username Username for authentication.
         * @param password Password for authentication.
         * @return A new instance of LogonCommand.
         */
        fun create(seq: Int, channels: Array<String>, auth_token: String?, refresh_token: String?, username: String?, password: String?): LogonCommand {
            return LogonCommand(seq, auth_token, refresh_token, username, password, channels, null, null, null, null)
        }
    }
}