// automatically generated by the FlatBuffers compiler, do not modify


// @generated

use core::mem;
use core::cmp::Ordering;

extern crate flatbuffers;
use self::flatbuffers::{EndianScalar, Follow};

pub enum EquipmentTemplateOffset {}
#[derive(Copy, Clone, PartialEq)]

pub struct EquipmentTemplate<'a> {
  pub _tab: flatbuffers::Table<'a>,
}

impl<'a> flatbuffers::Follow<'a> for EquipmentTemplate<'a> {
  type Inner = EquipmentTemplate<'a>;
  #[inline]
  unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {
    Self { _tab: flatbuffers::Table::new(buf, loc) }
  }
}

impl<'a> EquipmentTemplate<'a> {
  pub const VT_ITEM_ID: flatbuffers::VOffsetT = 4;
  pub const VT_EQUIPMENT_TYPE: flatbuffers::VOffsetT = 6;
  pub const VT_SUIT_TYPE: flatbuffers::VOffsetT = 8;
  pub const VT_DISK_ICON_PATH: flatbuffers::VOffsetT = 10;
  pub const VT_DRAWING_PATH: flatbuffers::VOffsetT = 12;
  pub const VT_FRONT_LABEL_TEXTURE_PATH: flatbuffers::VOffsetT = 14;
  pub const VT_BACK_LABEL_TEXTURE_PATH: flatbuffers::VOffsetT = 16;
  pub const VT_DISK_TEXTURE_PATH: flatbuffers::VOffsetT = 18;
  pub const VT_PLAY_MUSIC_TAG: flatbuffers::VOffsetT = 20;
  pub const VT_PAUSE_MUSIC_TAG: flatbuffers::VOffsetT = 22;

  #[inline]
  pub unsafe fn init_from_table(table: flatbuffers::Table<'a>) -> Self {
    EquipmentTemplate { _tab: table }
  }
  #[allow(unused_mut)]
  pub fn create<'bldr: 'args, 'args: 'mut_bldr, 'mut_bldr, A: flatbuffers::Allocator + 'bldr>(
    _fbb: &'mut_bldr mut flatbuffers::FlatBufferBuilder<'bldr, A>,
    args: &'args EquipmentTemplateArgs<'args>
  ) -> flatbuffers::WIPOffset<EquipmentTemplate<'bldr>> {
    let mut builder = EquipmentTemplateBuilder::new(_fbb);
    if let Some(x) = args.pause_music_tag { builder.add_pause_music_tag(x); }
    if let Some(x) = args.play_music_tag { builder.add_play_music_tag(x); }
    if let Some(x) = args.disk_texture_path { builder.add_disk_texture_path(x); }
    if let Some(x) = args.back_label_texture_path { builder.add_back_label_texture_path(x); }
    if let Some(x) = args.front_label_texture_path { builder.add_front_label_texture_path(x); }
    if let Some(x) = args.drawing_path { builder.add_drawing_path(x); }
    if let Some(x) = args.disk_icon_path { builder.add_disk_icon_path(x); }
    builder.add_suit_type(args.suit_type);
    builder.add_equipment_type(args.equipment_type);
    builder.add_item_id(args.item_id);
    builder.finish()
  }


  #[inline]
  pub fn item_id(&self) -> u32 {
    // Safety:
    // Created from valid Table for this object
    // which contains a valid value in this slot
    unsafe { self._tab.get::<u32>(EquipmentTemplate::VT_ITEM_ID, Some(0)).unwrap()}
  }
  #[inline]
  pub fn equipment_type(&self) -> u32 {
    // Safety:
    // Created from valid Table for this object
    // which contains a valid value in this slot
    unsafe { self._tab.get::<u32>(EquipmentTemplate::VT_EQUIPMENT_TYPE, Some(0)).unwrap()}
  }
  #[inline]
  pub fn suit_type(&self) -> u32 {
    // Safety:
    // Created from valid Table for this object
    // which contains a valid value in this slot
    unsafe { self._tab.get::<u32>(EquipmentTemplate::VT_SUIT_TYPE, Some(0)).unwrap()}
  }
  #[inline]
  pub fn disk_icon_path(&self) -> Option<&'a str> {
    // Safety:
    // Created from valid Table for this object
    // which contains a valid value in this slot
    unsafe { self._tab.get::<flatbuffers::ForwardsUOffset<&str>>(EquipmentTemplate::VT_DISK_ICON_PATH, None)}
  }
  #[inline]
  pub fn drawing_path(&self) -> Option<&'a str> {
    // Safety:
    // Created from valid Table for this object
    // which contains a valid value in this slot
    unsafe { self._tab.get::<flatbuffers::ForwardsUOffset<&str>>(EquipmentTemplate::VT_DRAWING_PATH, None)}
  }
  #[inline]
  pub fn front_label_texture_path(&self) -> Option<&'a str> {
    // Safety:
    // Created from valid Table for this object
    // which contains a valid value in this slot
    unsafe { self._tab.get::<flatbuffers::ForwardsUOffset<&str>>(EquipmentTemplate::VT_FRONT_LABEL_TEXTURE_PATH, None)}
  }
  #[inline]
  pub fn back_label_texture_path(&self) -> Option<&'a str> {
    // Safety:
    // Created from valid Table for this object
    // which contains a valid value in this slot
    unsafe { self._tab.get::<flatbuffers::ForwardsUOffset<&str>>(EquipmentTemplate::VT_BACK_LABEL_TEXTURE_PATH, None)}
  }
  #[inline]
  pub fn disk_texture_path(&self) -> Option<&'a str> {
    // Safety:
    // Created from valid Table for this object
    // which contains a valid value in this slot
    unsafe { self._tab.get::<flatbuffers::ForwardsUOffset<&str>>(EquipmentTemplate::VT_DISK_TEXTURE_PATH, None)}
  }
  #[inline]
  pub fn play_music_tag(&self) -> Option<&'a str> {
    // Safety:
    // Created from valid Table for this object
    // which contains a valid value in this slot
    unsafe { self._tab.get::<flatbuffers::ForwardsUOffset<&str>>(EquipmentTemplate::VT_PLAY_MUSIC_TAG, None)}
  }
  #[inline]
  pub fn pause_music_tag(&self) -> Option<&'a str> {
    // Safety:
    // Created from valid Table for this object
    // which contains a valid value in this slot
    unsafe { self._tab.get::<flatbuffers::ForwardsUOffset<&str>>(EquipmentTemplate::VT_PAUSE_MUSIC_TAG, None)}
  }
}

impl flatbuffers::Verifiable for EquipmentTemplate<'_> {
  #[inline]
  fn run_verifier(
    v: &mut flatbuffers::Verifier, pos: usize
  ) -> Result<(), flatbuffers::InvalidFlatbuffer> {
    use self::flatbuffers::Verifiable;
    v.visit_table(pos)?
     .visit_field::<u32>("item_id", Self::VT_ITEM_ID, false)?
     .visit_field::<u32>("equipment_type", Self::VT_EQUIPMENT_TYPE, false)?
     .visit_field::<u32>("suit_type", Self::VT_SUIT_TYPE, false)?
     .visit_field::<flatbuffers::ForwardsUOffset<&str>>("disk_icon_path", Self::VT_DISK_ICON_PATH, false)?
     .visit_field::<flatbuffers::ForwardsUOffset<&str>>("drawing_path", Self::VT_DRAWING_PATH, false)?
     .visit_field::<flatbuffers::ForwardsUOffset<&str>>("front_label_texture_path", Self::VT_FRONT_LABEL_TEXTURE_PATH, false)?
     .visit_field::<flatbuffers::ForwardsUOffset<&str>>("back_label_texture_path", Self::VT_BACK_LABEL_TEXTURE_PATH, false)?
     .visit_field::<flatbuffers::ForwardsUOffset<&str>>("disk_texture_path", Self::VT_DISK_TEXTURE_PATH, false)?
     .visit_field::<flatbuffers::ForwardsUOffset<&str>>("play_music_tag", Self::VT_PLAY_MUSIC_TAG, false)?
     .visit_field::<flatbuffers::ForwardsUOffset<&str>>("pause_music_tag", Self::VT_PAUSE_MUSIC_TAG, false)?
     .finish();
    Ok(())
  }
}
pub struct EquipmentTemplateArgs<'a> {
    pub item_id: u32,
    pub equipment_type: u32,
    pub suit_type: u32,
    pub disk_icon_path: Option<flatbuffers::WIPOffset<&'a str>>,
    pub drawing_path: Option<flatbuffers::WIPOffset<&'a str>>,
    pub front_label_texture_path: Option<flatbuffers::WIPOffset<&'a str>>,
    pub back_label_texture_path: Option<flatbuffers::WIPOffset<&'a str>>,
    pub disk_texture_path: Option<flatbuffers::WIPOffset<&'a str>>,
    pub play_music_tag: Option<flatbuffers::WIPOffset<&'a str>>,
    pub pause_music_tag: Option<flatbuffers::WIPOffset<&'a str>>,
}
impl<'a> Default for EquipmentTemplateArgs<'a> {
  #[inline]
  fn default() -> Self {
    EquipmentTemplateArgs {
      item_id: 0,
      equipment_type: 0,
      suit_type: 0,
      disk_icon_path: None,
      drawing_path: None,
      front_label_texture_path: None,
      back_label_texture_path: None,
      disk_texture_path: None,
      play_music_tag: None,
      pause_music_tag: None,
    }
  }
}

pub struct EquipmentTemplateBuilder<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> {
  fbb_: &'b mut flatbuffers::FlatBufferBuilder<'a, A>,
  start_: flatbuffers::WIPOffset<flatbuffers::TableUnfinishedWIPOffset>,
}
impl<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> EquipmentTemplateBuilder<'a, 'b, A> {
  #[inline]
  pub fn add_item_id(&mut self, item_id: u32) {
    self.fbb_.push_slot::<u32>(EquipmentTemplate::VT_ITEM_ID, item_id, 0);
  }
  #[inline]
  pub fn add_equipment_type(&mut self, equipment_type: u32) {
    self.fbb_.push_slot::<u32>(EquipmentTemplate::VT_EQUIPMENT_TYPE, equipment_type, 0);
  }
  #[inline]
  pub fn add_suit_type(&mut self, suit_type: u32) {
    self.fbb_.push_slot::<u32>(EquipmentTemplate::VT_SUIT_TYPE, suit_type, 0);
  }
  #[inline]
  pub fn add_disk_icon_path(&mut self, disk_icon_path: flatbuffers::WIPOffset<&'b  str>) {
    self.fbb_.push_slot_always::<flatbuffers::WIPOffset<_>>(EquipmentTemplate::VT_DISK_ICON_PATH, disk_icon_path);
  }
  #[inline]
  pub fn add_drawing_path(&mut self, drawing_path: flatbuffers::WIPOffset<&'b  str>) {
    self.fbb_.push_slot_always::<flatbuffers::WIPOffset<_>>(EquipmentTemplate::VT_DRAWING_PATH, drawing_path);
  }
  #[inline]
  pub fn add_front_label_texture_path(&mut self, front_label_texture_path: flatbuffers::WIPOffset<&'b  str>) {
    self.fbb_.push_slot_always::<flatbuffers::WIPOffset<_>>(EquipmentTemplate::VT_FRONT_LABEL_TEXTURE_PATH, front_label_texture_path);
  }
  #[inline]
  pub fn add_back_label_texture_path(&mut self, back_label_texture_path: flatbuffers::WIPOffset<&'b  str>) {
    self.fbb_.push_slot_always::<flatbuffers::WIPOffset<_>>(EquipmentTemplate::VT_BACK_LABEL_TEXTURE_PATH, back_label_texture_path);
  }
  #[inline]
  pub fn add_disk_texture_path(&mut self, disk_texture_path: flatbuffers::WIPOffset<&'b  str>) {
    self.fbb_.push_slot_always::<flatbuffers::WIPOffset<_>>(EquipmentTemplate::VT_DISK_TEXTURE_PATH, disk_texture_path);
  }
  #[inline]
  pub fn add_play_music_tag(&mut self, play_music_tag: flatbuffers::WIPOffset<&'b  str>) {
    self.fbb_.push_slot_always::<flatbuffers::WIPOffset<_>>(EquipmentTemplate::VT_PLAY_MUSIC_TAG, play_music_tag);
  }
  #[inline]
  pub fn add_pause_music_tag(&mut self, pause_music_tag: flatbuffers::WIPOffset<&'b  str>) {
    self.fbb_.push_slot_always::<flatbuffers::WIPOffset<_>>(EquipmentTemplate::VT_PAUSE_MUSIC_TAG, pause_music_tag);
  }
  #[inline]
  pub fn new(_fbb: &'b mut flatbuffers::FlatBufferBuilder<'a, A>) -> EquipmentTemplateBuilder<'a, 'b, A> {
    let start = _fbb.start_table();
    EquipmentTemplateBuilder {
      fbb_: _fbb,
      start_: start,
    }
  }
  #[inline]
  pub fn finish(self) -> flatbuffers::WIPOffset<EquipmentTemplate<'a>> {
    let o = self.fbb_.end_table(self.start_);
    flatbuffers::WIPOffset::new(o.value())
  }
}

impl core::fmt::Debug for EquipmentTemplate<'_> {
  fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
    let mut ds = f.debug_struct("EquipmentTemplate");
      ds.field("item_id", &self.item_id());
      ds.field("equipment_type", &self.equipment_type());
      ds.field("suit_type", &self.suit_type());
      ds.field("disk_icon_path", &self.disk_icon_path());
      ds.field("drawing_path", &self.drawing_path());
      ds.field("front_label_texture_path", &self.front_label_texture_path());
      ds.field("back_label_texture_path", &self.back_label_texture_path());
      ds.field("disk_texture_path", &self.disk_texture_path());
      ds.field("play_music_tag", &self.play_music_tag());
      ds.field("pause_music_tag", &self.pause_music_tag());
      ds.finish()
  }
}
pub enum EquipmentTemplateTbOffset {}
#[derive(Copy, Clone, PartialEq)]

pub struct EquipmentTemplateTb<'a> {
  pub _tab: flatbuffers::Table<'a>,
}

impl<'a> flatbuffers::Follow<'a> for EquipmentTemplateTb<'a> {
  type Inner = EquipmentTemplateTb<'a>;
  #[inline]
  unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {
    Self { _tab: flatbuffers::Table::new(buf, loc) }
  }
}

impl<'a> EquipmentTemplateTb<'a> {
  pub const VT_DATA: flatbuffers::VOffsetT = 4;

  #[inline]
  pub unsafe fn init_from_table(table: flatbuffers::Table<'a>) -> Self {
    EquipmentTemplateTb { _tab: table }
  }
  #[allow(unused_mut)]
  pub fn create<'bldr: 'args, 'args: 'mut_bldr, 'mut_bldr, A: flatbuffers::Allocator + 'bldr>(
    _fbb: &'mut_bldr mut flatbuffers::FlatBufferBuilder<'bldr, A>,
    args: &'args EquipmentTemplateTbArgs<'args>
  ) -> flatbuffers::WIPOffset<EquipmentTemplateTb<'bldr>> {
    let mut builder = EquipmentTemplateTbBuilder::new(_fbb);
    if let Some(x) = args.data { builder.add_data(x); }
    builder.finish()
  }


  #[inline]
  pub fn data(&self) -> Option<flatbuffers::Vector<'a, flatbuffers::ForwardsUOffset<EquipmentTemplate<'a>>>> {
    // Safety:
    // Created from valid Table for this object
    // which contains a valid value in this slot
    unsafe { self._tab.get::<flatbuffers::ForwardsUOffset<flatbuffers::Vector<'a, flatbuffers::ForwardsUOffset<EquipmentTemplate>>>>(EquipmentTemplateTb::VT_DATA, None)}
  }
}

impl flatbuffers::Verifiable for EquipmentTemplateTb<'_> {
  #[inline]
  fn run_verifier(
    v: &mut flatbuffers::Verifier, pos: usize
  ) -> Result<(), flatbuffers::InvalidFlatbuffer> {
    use self::flatbuffers::Verifiable;
    v.visit_table(pos)?
     .visit_field::<flatbuffers::ForwardsUOffset<flatbuffers::Vector<'_, flatbuffers::ForwardsUOffset<EquipmentTemplate>>>>("data", Self::VT_DATA, false)?
     .finish();
    Ok(())
  }
}
pub struct EquipmentTemplateTbArgs<'a> {
    pub data: Option<flatbuffers::WIPOffset<flatbuffers::Vector<'a, flatbuffers::ForwardsUOffset<EquipmentTemplate<'a>>>>>,
}
impl<'a> Default for EquipmentTemplateTbArgs<'a> {
  #[inline]
  fn default() -> Self {
    EquipmentTemplateTbArgs {
      data: None,
    }
  }
}

pub struct EquipmentTemplateTbBuilder<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> {
  fbb_: &'b mut flatbuffers::FlatBufferBuilder<'a, A>,
  start_: flatbuffers::WIPOffset<flatbuffers::TableUnfinishedWIPOffset>,
}
impl<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> EquipmentTemplateTbBuilder<'a, 'b, A> {
  #[inline]
  pub fn add_data(&mut self, data: flatbuffers::WIPOffset<flatbuffers::Vector<'b , flatbuffers::ForwardsUOffset<EquipmentTemplate<'b >>>>) {
    self.fbb_.push_slot_always::<flatbuffers::WIPOffset<_>>(EquipmentTemplateTb::VT_DATA, data);
  }
  #[inline]
  pub fn new(_fbb: &'b mut flatbuffers::FlatBufferBuilder<'a, A>) -> EquipmentTemplateTbBuilder<'a, 'b, A> {
    let start = _fbb.start_table();
    EquipmentTemplateTbBuilder {
      fbb_: _fbb,
      start_: start,
    }
  }
  #[inline]
  pub fn finish(self) -> flatbuffers::WIPOffset<EquipmentTemplateTb<'a>> {
    let o = self.fbb_.end_table(self.start_);
    flatbuffers::WIPOffset::new(o.value())
  }
}

impl core::fmt::Debug for EquipmentTemplateTb<'_> {
  fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
    let mut ds = f.debug_struct("EquipmentTemplateTb");
      ds.field("data", &self.data());
      ds.finish()
  }
}
