//! `Note` type.

use super::pnts;
use crate::{durandal::err::*, marathon::text::*};

/// Reads a `NOTE` chunk.
pub fn read(b: &[u8]) -> ResultS<(Note, usize)>
{
   read_data! {
      endian: BIG, buf: b, size: 72, start: 0, data {
         let pos  = pnts::read_o[2; 4];
         let poly = u16[6];
         let text = mac_roman_cstr[8; 64] no_try;
      }
   }

   Ok((Note{pos, poly, text}, 72))
}

/// Overhead map annotations.
#[cfg_attr(feature = "serde_obj", derive(serde::Serialize))]
#[derive(Debug, Eq, PartialEq)]
pub struct Note
{
   pub pos:  pnts::Point,
   pub poly: u16,
   pub text: String,
}

// EOF
