const useFormatCustomDataToSelect = (Data: any) => {
  const Period_1 = [
    " الأولى",
    " الثانية",
    " الثالثة",
    " الرابعة",
    " الخامسة",
    " السادسة",
    " السابعة",
    " الثامنة",
    " التاسعة",
    " العاشرة",
  ];

  const format = (data: any) => {
    if (!Array.isArray(data)) return []; // Check if data is an array
    // console.log(data);

    return data?.map((item: any) => {
      const periodLabel = "الحصة" + Period_1[item?.order];

      // console.log(Period_1[item?.order]);

      return {
        value: item?.id,
        label: item?.subject?.name + "  " + periodLabel,
        subject_id: item?.subject?.id,
      };
    });
  };

  return format(Data);
};

export default useFormatCustomDataToSelect;
