interface FamilyMember {
  avatar: string;
  name: string;
  gender: string;
  birthday: string;
  relation: string;
  bloodType: string;
  allergies: string;
  chronicDiseases: string;
  longTermMeds: string;
  notes: string;
}

const EDIT_URL = '/pages/tab-bar/profile/edit/index';
const RED_HISTORY_URL = '/pages/live/red-history/red-history';

Page({
  data: {
    member: {} as FamilyMember,
  },
  onShow() {
    if (typeof this.getTabBar === 'function' && this.getTabBar()) {
      this.getTabBar().setData({ selected: 3 });
    }
    this.loadMember();
  },
  loadMember() {
    const member = wx.getStorageSync('family_member') || {};
    this.setData({ member });
  },
  goEdit() {
    wx.navigateTo({ url: EDIT_URL });
  },
  goRedHistory() {
    wx.navigateTo({ url: RED_HISTORY_URL });
  },
});