import DictionariesBehavior from "../../../../core/behavior/dictionaries.behavior";

// module/health/components/report-health-patient/report-health-patient.ts
Component({
  behaviors: [DictionariesBehavior],
  options: {
    multipleSlots: true,
  },
  properties: {
    dataset: { type: Object },
    loading: { type: Boolean, value: false },
    message: { type: String, value: '' },
  },
  data: {
    hobbyFlavor: [] as string[],
    foodAllergy: [] as string[],
    specialPeriod: [] as string[],
    job: [] as string[],

    phone: '',
    cardno: '',
  },
  observers: {
    // 'dataset.phone'(value: string) {
    //   this.setData({ phone: value?.slice(0, 3).padEnd(12, '*') ?? '' })
    // },
    // 'dataset.cardno'(value: string) {
    //   this.setData({ cardno: value?.slice(0, 3).padEnd(18, '*') ?? '' })
    // },
    'dataset.womenSpecialPeriod'(value: string) {
      const values = value?.split(',') ?? []
      this.setData({ specialPeriod: values.filter(Boolean) })
    },
    'dataset.job'(value: string) {
      const values = value?.split(',') ?? []
      this.setData({ job: values.filter(Boolean) })
    },
    'dataset.hobbyFlavor'(value: string) {
      const values = value?.split(',') ?? []
      this.setData({ hobbyFlavor: values.filter(Boolean) })
    },
    'dataset.foodAllergy'(value: string) {
      const values = value?.split(',') ?? []
      this.setData({ foodAllergy: values.filter(Boolean) })
    }
  }
})