// 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 SubAreaDataTemplateOffset {}
#[derive(Copy, Clone, PartialEq)]

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

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

impl<'a> SubAreaDataTemplate<'a> {
  pub const VT_AREA_ID: flatbuffers::VOffsetT = 4;
  pub const VT_BATTLE_EVENT_ID: flatbuffers::VOffsetT = 6;
  pub const VT_FC_ASSET_PATH: flatbuffers::VOffsetT = 8;
  pub const VT_UNK_1: flatbuffers::VOffsetT = 10;
  pub const VT_UNK_2: flatbuffers::VOffsetT = 12;
  pub const VT_TIME_PERIOD: flatbuffers::VOffsetT = 14;
  pub const VT_WEATHER: flatbuffers::VOffsetT = 16;

  #[inline]
  pub unsafe fn init_from_table(table: flatbuffers::Table<'a>) -> Self {
    SubAreaDataTemplate { _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 SubAreaDataTemplateArgs<'args>
  ) -> flatbuffers::WIPOffset<SubAreaDataTemplate<'bldr>> {
    let mut builder = SubAreaDataTemplateBuilder::new(_fbb);
    if let Some(x) = args.weather { builder.add_weather(x); }
    if let Some(x) = args.time_period { builder.add_time_period(x); }
    if let Some(x) = args.unk_2 { builder.add_unk_2(x); }
    if let Some(x) = args.unk_1 { builder.add_unk_1(x); }
    if let Some(x) = args.fc_asset_path { builder.add_fc_asset_path(x); }
    builder.add_battle_event_id(args.battle_event_id);
    builder.add_area_id(args.area_id);
    builder.finish()
  }


  #[inline]
  pub fn area_id(&self) -> u32 {
    // Safety:
    // Created from valid Table for this object
    // which contains a valid value in this slot
    unsafe { self._tab.get::<u32>(SubAreaDataTemplate::VT_AREA_ID, Some(0)).unwrap()}
  }
  #[inline]
  pub fn battle_event_id(&self) -> u32 {
    // Safety:
    // Created from valid Table for this object
    // which contains a valid value in this slot
    unsafe { self._tab.get::<u32>(SubAreaDataTemplate::VT_BATTLE_EVENT_ID, Some(0)).unwrap()}
  }
  #[inline]
  pub fn fc_asset_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>>(SubAreaDataTemplate::VT_FC_ASSET_PATH, None)}
  }
  #[inline]
  pub fn unk_1(&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>>(SubAreaDataTemplate::VT_UNK_1, None)}
  }
  #[inline]
  pub fn unk_2(&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>>(SubAreaDataTemplate::VT_UNK_2, None)}
  }
  #[inline]
  pub fn time_period(&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>>(SubAreaDataTemplate::VT_TIME_PERIOD, None)}
  }
  #[inline]
  pub fn weather(&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>>(SubAreaDataTemplate::VT_WEATHER, None)}
  }
}

impl flatbuffers::Verifiable for SubAreaDataTemplate<'_> {
  #[inline]
  fn run_verifier(
    v: &mut flatbuffers::Verifier, pos: usize
  ) -> Result<(), flatbuffers::InvalidFlatbuffer> {
    use self::flatbuffers::Verifiable;
    v.visit_table(pos)?
     .visit_field::<u32>("area_id", Self::VT_AREA_ID, false)?
     .visit_field::<u32>("battle_event_id", Self::VT_BATTLE_EVENT_ID, false)?
     .visit_field::<flatbuffers::ForwardsUOffset<&str>>("fc_asset_path", Self::VT_FC_ASSET_PATH, false)?
     .visit_field::<flatbuffers::ForwardsUOffset<&str>>("unk_1", Self::VT_UNK_1, false)?
     .visit_field::<flatbuffers::ForwardsUOffset<&str>>("unk_2", Self::VT_UNK_2, false)?
     .visit_field::<flatbuffers::ForwardsUOffset<&str>>("time_period", Self::VT_TIME_PERIOD, false)?
     .visit_field::<flatbuffers::ForwardsUOffset<&str>>("weather", Self::VT_WEATHER, false)?
     .finish();
    Ok(())
  }
}
pub struct SubAreaDataTemplateArgs<'a> {
    pub area_id: u32,
    pub battle_event_id: u32,
    pub fc_asset_path: Option<flatbuffers::WIPOffset<&'a str>>,
    pub unk_1: Option<flatbuffers::WIPOffset<&'a str>>,
    pub unk_2: Option<flatbuffers::WIPOffset<&'a str>>,
    pub time_period: Option<flatbuffers::WIPOffset<&'a str>>,
    pub weather: Option<flatbuffers::WIPOffset<&'a str>>,
}
impl<'a> Default for SubAreaDataTemplateArgs<'a> {
  #[inline]
  fn default() -> Self {
    SubAreaDataTemplateArgs {
      area_id: 0,
      battle_event_id: 0,
      fc_asset_path: None,
      unk_1: None,
      unk_2: None,
      time_period: None,
      weather: None,
    }
  }
}

pub struct SubAreaDataTemplateBuilder<'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> SubAreaDataTemplateBuilder<'a, 'b, A> {
  #[inline]
  pub fn add_area_id(&mut self, area_id: u32) {
    self.fbb_.push_slot::<u32>(SubAreaDataTemplate::VT_AREA_ID, area_id, 0);
  }
  #[inline]
  pub fn add_battle_event_id(&mut self, battle_event_id: u32) {
    self.fbb_.push_slot::<u32>(SubAreaDataTemplate::VT_BATTLE_EVENT_ID, battle_event_id, 0);
  }
  #[inline]
  pub fn add_fc_asset_path(&mut self, fc_asset_path: flatbuffers::WIPOffset<&'b  str>) {
    self.fbb_.push_slot_always::<flatbuffers::WIPOffset<_>>(SubAreaDataTemplate::VT_FC_ASSET_PATH, fc_asset_path);
  }
  #[inline]
  pub fn add_unk_1(&mut self, unk_1: flatbuffers::WIPOffset<&'b  str>) {
    self.fbb_.push_slot_always::<flatbuffers::WIPOffset<_>>(SubAreaDataTemplate::VT_UNK_1, unk_1);
  }
  #[inline]
  pub fn add_unk_2(&mut self, unk_2: flatbuffers::WIPOffset<&'b  str>) {
    self.fbb_.push_slot_always::<flatbuffers::WIPOffset<_>>(SubAreaDataTemplate::VT_UNK_2, unk_2);
  }
  #[inline]
  pub fn add_time_period(&mut self, time_period: flatbuffers::WIPOffset<&'b  str>) {
    self.fbb_.push_slot_always::<flatbuffers::WIPOffset<_>>(SubAreaDataTemplate::VT_TIME_PERIOD, time_period);
  }
  #[inline]
  pub fn add_weather(&mut self, weather: flatbuffers::WIPOffset<&'b  str>) {
    self.fbb_.push_slot_always::<flatbuffers::WIPOffset<_>>(SubAreaDataTemplate::VT_WEATHER, weather);
  }
  #[inline]
  pub fn new(_fbb: &'b mut flatbuffers::FlatBufferBuilder<'a, A>) -> SubAreaDataTemplateBuilder<'a, 'b, A> {
    let start = _fbb.start_table();
    SubAreaDataTemplateBuilder {
      fbb_: _fbb,
      start_: start,
    }
  }
  #[inline]
  pub fn finish(self) -> flatbuffers::WIPOffset<SubAreaDataTemplate<'a>> {
    let o = self.fbb_.end_table(self.start_);
    flatbuffers::WIPOffset::new(o.value())
  }
}

impl core::fmt::Debug for SubAreaDataTemplate<'_> {
  fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
    let mut ds = f.debug_struct("SubAreaDataTemplate");
      ds.field("area_id", &self.area_id());
      ds.field("battle_event_id", &self.battle_event_id());
      ds.field("fc_asset_path", &self.fc_asset_path());
      ds.field("unk_1", &self.unk_1());
      ds.field("unk_2", &self.unk_2());
      ds.field("time_period", &self.time_period());
      ds.field("weather", &self.weather());
      ds.finish()
  }
}
pub enum SubAreaDataTemplateTbOffset {}
#[derive(Copy, Clone, PartialEq)]

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

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

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

  #[inline]
  pub unsafe fn init_from_table(table: flatbuffers::Table<'a>) -> Self {
    SubAreaDataTemplateTb { _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 SubAreaDataTemplateTbArgs<'args>
  ) -> flatbuffers::WIPOffset<SubAreaDataTemplateTb<'bldr>> {
    let mut builder = SubAreaDataTemplateTbBuilder::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<SubAreaDataTemplate<'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<SubAreaDataTemplate>>>>(SubAreaDataTemplateTb::VT_DATA, None)}
  }
}

impl flatbuffers::Verifiable for SubAreaDataTemplateTb<'_> {
  #[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<SubAreaDataTemplate>>>>("data", Self::VT_DATA, false)?
     .finish();
    Ok(())
  }
}
pub struct SubAreaDataTemplateTbArgs<'a> {
    pub data: Option<flatbuffers::WIPOffset<flatbuffers::Vector<'a, flatbuffers::ForwardsUOffset<SubAreaDataTemplate<'a>>>>>,
}
impl<'a> Default for SubAreaDataTemplateTbArgs<'a> {
  #[inline]
  fn default() -> Self {
    SubAreaDataTemplateTbArgs {
      data: None,
    }
  }
}

pub struct SubAreaDataTemplateTbBuilder<'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> SubAreaDataTemplateTbBuilder<'a, 'b, A> {
  #[inline]
  pub fn add_data(&mut self, data: flatbuffers::WIPOffset<flatbuffers::Vector<'b , flatbuffers::ForwardsUOffset<SubAreaDataTemplate<'b >>>>) {
    self.fbb_.push_slot_always::<flatbuffers::WIPOffset<_>>(SubAreaDataTemplateTb::VT_DATA, data);
  }
  #[inline]
  pub fn new(_fbb: &'b mut flatbuffers::FlatBufferBuilder<'a, A>) -> SubAreaDataTemplateTbBuilder<'a, 'b, A> {
    let start = _fbb.start_table();
    SubAreaDataTemplateTbBuilder {
      fbb_: _fbb,
      start_: start,
    }
  }
  #[inline]
  pub fn finish(self) -> flatbuffers::WIPOffset<SubAreaDataTemplateTb<'a>> {
    let o = self.fbb_.end_table(self.start_);
    flatbuffers::WIPOffset::new(o.value())
  }
}

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