package utils

import (
	"cpone/models"
	"strings"
)

func GetIdSurveyMcu(id string) string {
	return id
}

func ConcatHxIncludeSurveyMcu(dataSurveyMcu []models.SurveyMcu) string {
	var elements []string

	if len(dataSurveyMcu) > 0 {
		for _, x := range dataSurveyMcu {
			// radio button
			if len(x.DataListItemSurveyMcu) > 0 {
				for _, v := range x.DataListItemSurveyMcu {
					elements = append(elements, "[name='radio-"+v.IDItemSurvey+"']", "[name='default-radio-"+v.IDItemSurvey+"']", "[name='id-radio']")
				}
			}

			// saran
			if len(x.DataListItemSurveyMcuSaran) > 0 {
				for _, v := range x.DataListItemSurveyMcuSaran {
					elements = append(elements, "[name='saranmcu-"+v.IDItemSurveyMcuSaran+"']", "[name='default-saranmcu-"+v.IDItemSurveyMcuSaran+"']", "[name='id-saran']")
				}
			}
		}
	}

	// Gabungkan semua elemen dengan koma
	return strings.Join(elements, ", ")
}
