import flet as ft

class FormData:
    tags: list[list[str]] = [
    ["Fraud/Kecurangan/Korupsi","white10"],
    ["Pelanggaran Kode Etik/Peraturan Perusahaan","white10"],
    ["Pelanggaran Hukum","white10"],
    ["Gratifikasi","white10"],
    ["Suap","white10"],
    ["Kekerasan","white10"],
    ["Lainnya","white10"],
    ]

    @staticmethod
    def update_tags(tag:list[str], instance: object):
        new_tag: list[str] = [tag[0], ft.colors.with_opacity(opacity=0.61, color="green")]
        
        FormData.tags = [
            new_tag if item[0] == new_tag[0] else [item[0],
            "white10"]
            for item in FormData.tags
        ]
        
        instance.tags.controls = instance.render_tags()
        instance.tags.update()


