import json

class AuxLine:
    def __init__(self):
        self.name      = None
        self.value     = None
        self.label     = None
        self.lineStyle = '--'
        self.color     = 'k'
        self.lineWidth = 1.5
        self.checked   = True
        return None

    def set_name(self, name):
        self.name = name
        return None
    
    def set_value(self, value):
        self.value = value
        return None

    def set_label(self, label):
        self.label = label
        return None

    def set_lineStyle(self, ls):
        self.lineStyle = ls
        return None

    def set_color(self, color):
        self.color = color
        return None

    def set_LW(self, w):
        self.lineWidth = w
        return None

    def set_checked(self, checked):
        self.checked = checked
        return None

    def get_name(self):
        return self.name

    def get_label(self):
        return self.label

    def get_value(self):
        return self.value

    def get_lineStyle(self):
        return self.lineStyle

    def get_color(self):
        return self.color

    def get_LW(self):
        return self.lineWidth

    def get_check_state(self):
        return self.checked


    def to_json(self):
        """Se exporta a una archivo .txt un diccionario con todos los argumentos para poder instanciar
        el objeto auxiliar line"""
        to_save = { 'type': self.__class__.__name__,
                    'init_args_d': { 'name'     : self.get_name(),
                                     'value'    : self.get_value(),
                                     'label'    : self.get_label(),
                                     'lineStyle': self.get_lineStyle(),
                                     'color'    : self.get_color(),
                                     'lineWidth': self.get_LW(),
                                     'checked'  : self.get_check_state(),
                                    }
                   }
    
        return json.dumps(to_save)
