-- This file is generated by tools/json2lua.js

local ffxiv_ipc_mail_letter_notification = Proto("ffxiv_ipc_mail_letter_notification", "FFXIV-IPC Mail Letter Notification")

local mail_letter_notification_fields = {
  sendback_count  = ProtoField.uint32("ffxiv_ipc_mail_letter_notification.sendback_count", "sendbackCount", base.DEC),
  friend_letters  = ProtoField.uint16("ffxiv_ipc_mail_letter_notification.friend_letters", "friendLetters", base.DEC),
  unread_count    = ProtoField.uint16("ffxiv_ipc_mail_letter_notification.unread_count", "unreadCount", base.DEC),
  reward_letters  = ProtoField.uint16("ffxiv_ipc_mail_letter_notification.reward_letters", "rewardLetters", base.DEC),
  is_gm_letter    = ProtoField.uint8("ffxiv_ipc_mail_letter_notification.is_gm_letter", "isGmLetter", base.DEC),
  is_support_desk = ProtoField.uint8("ffxiv_ipc_mail_letter_notification.is_support_desk", "isSupportDesk", base.DEC),
}

ffxiv_ipc_mail_letter_notification.fields = mail_letter_notification_fields

function ffxiv_ipc_mail_letter_notification.dissector(tvbuf, pktinfo, root)
  local tree = root:add(ffxiv_ipc_mail_letter_notification, tvbuf)
  pktinfo.cols.info:set("Mail Letter Notification")

  local len = tvbuf:len()

  -- dissect the sendback_count field
  local sendback_count_tvbr = tvbuf:range(0, 4)
  local sendback_count_val  = sendback_count_tvbr:le_uint()
  tree:add_le(mail_letter_notification_fields.sendback_count, sendback_count_tvbr, sendback_count_val)

  -- dissect the friend_letters field
  local friend_letters_tvbr = tvbuf:range(4, 2)
  local friend_letters_val  = friend_letters_tvbr:le_uint()
  tree:add_le(mail_letter_notification_fields.friend_letters, friend_letters_tvbr, friend_letters_val)

  -- dissect the unread_count field
  local unread_count_tvbr = tvbuf:range(6, 2)
  local unread_count_val  = unread_count_tvbr:le_uint()
  tree:add_le(mail_letter_notification_fields.unread_count, unread_count_tvbr, unread_count_val)

  -- dissect the reward_letters field
  local reward_letters_tvbr = tvbuf:range(8, 2)
  local reward_letters_val  = reward_letters_tvbr:le_uint()
  tree:add_le(mail_letter_notification_fields.reward_letters, reward_letters_tvbr, reward_letters_val)

  -- dissect the is_gm_letter field
  local is_gm_letter_tvbr = tvbuf:range(10, 1)
  local is_gm_letter_val  = is_gm_letter_tvbr:le_uint()
  tree:add_le(mail_letter_notification_fields.is_gm_letter, is_gm_letter_tvbr, is_gm_letter_val)

  -- dissect the is_support_desk field
  local is_support_desk_tvbr = tvbuf:range(11, 1)
  local is_support_desk_val  = is_support_desk_tvbr:le_uint()
  tree:add_le(mail_letter_notification_fields.is_support_desk, is_support_desk_tvbr, is_support_desk_val)

  return len
end