/*
 * The MIT License
 *
 * Copyright (c) 2016 Marcelo "Ataxexe" Guimarães <ataxexe@devnull.tools>
 *
 * Permission  is hereby granted, free of charge, to any person obtaining
 * a  copy  of  this  software  and  associated  documentation files (the
 * "Software"),  to  deal  in the Software without restriction, including
 * without  limitation  the  rights to use, copy, modify, merge, publish,
 * distribute,  sublicense,  and/or  sell  copies of the Software, and to
 * permit  persons to whom the Software is furnished to do so, subject to
 * the following conditions:
 * The  above  copyright  notice  and  this  permission  notice  shall be
 * included  in  all  copies  or  substantial  portions  of the Software.
 *
 * THE  SOFTWARE  IS  PROVIDED  "AS  IS",  WITHOUT  WARRANTY OF ANY KIND,
 * EXPRESS  OR  IMPLIED,  INCLUDING  BUT NOT LIMITED TO THE WARRANTIES OF
 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
 * IN  NO  EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
 * CLAIM,  DAMAGES  OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
 * TORT  OR  OTHERWISE,  ARISING  FROM,  OUT OF OR IN CONNECTION WITH THE
 * SOFTWARE   OR   THE   USE   OR   OTHER   DEALINGS  IN  THE  SOFTWARE.
 */

package tools.devnull.boteco.channel.telegram;

import tools.devnull.boteco.message.Sender;

import java.io.Serializable;

/**
 * A class that represents a result fetched by polling using
 * the Telegram Bot API.
 */
public class TelegramPolling {

  private Integer updateId;
  private Message message;

  public Integer getUpdateId() {
    return updateId;
  }

  public void setUpdateId(Integer updateId) {
    this.updateId = updateId;
  }

  public Message getMessage() {
    return message;
  }

  public void setMessage(Message message) {
    this.message = message;
  }

  public static class Message implements Serializable {

    private static final long serialVersionUID = 4815039289549492941L;

    private Integer messageId;
    private Integer date;
    private String text;
    private User from;
    private Chat chat;

    public Integer getMessageId() {
      return messageId;
    }

    public void setMessageId(Integer messageId) {
      this.messageId = messageId;
    }

    public User getFrom() {
      return from;
    }

    public void setFrom(User from) {
      this.from = from;
    }

    public Integer getDate() {
      return date;
    }

    public void setDate(Integer date) {
      this.date = date;
    }

    public String getText() {
      return text;
    }

    public void setText(String text) {
      this.text = text;
    }

    public Chat getChat() {
      return chat;
    }

    public void setChat(Chat chat) {
      this.chat = chat;
    }
  }

  public static class User implements Sender {

    private static final long serialVersionUID = -4899947249105033703L;

    private Integer id;
    private String firstName;
    private String lastName;
    private String username;

    @Override
    public String id() {
      return this.id.toString();
    }

    @Override
    public String name() {
      return lastName != null ? firstName + " " + lastName : firstName;
    }

    @Override
    public String username() {
      return username;
    }

    @Override
    public String mention() {
      return username != null ? "@" + username : name();
    }

    @Override
    public String toString() {
      return mention();
    }
  }

  public static class Chat implements Serializable {

    private static final long serialVersionUID = -5710706291447946436L;

    private Integer id;
    private String type;

    public Integer getId() {
      return id;
    }

    public void setId(Integer id) {
      this.id = id;
    }

    public String getType() {
      return type;
    }

    public void setType(String type) {
      this.type = type;
    }

  }

}

@@ -3565,39 +3565,36 @@
 L;%0A%0A    private 
-Integer
+Long
  id;%0A    private
@@ -3615,31 +3615,28 @@
 %0A    public 
-Integer
+Long
  getId() %7B%0A 
@@ -3680,23 +3680,20 @@
 d setId(
-Integer
+Long
  id) %7B%0A 

use long for chat_id