-- ============================================================================
-- Copyright (C) 2026 Alles Watt lauft
--
-- Table for installation element type templates (globally reusable)
-- Examples: Zaehlerschrank, Unterverteilung, Wallbox, Router, etc.
-- ============================================================================

CREATE TABLE llx_kundenkarte_anlage_type
(
    rowid               integer AUTO_INCREMENT PRIMARY KEY,
    entity              integer DEFAULT 0 NOT NULL,

    ref                 varchar(64) NOT NULL,
    label               varchar(255) NOT NULL,
    label_short         varchar(64),
    description         text,

    fk_system           integer NOT NULL,

    can_have_children   tinyint DEFAULT 0 NOT NULL,
    can_be_nested       tinyint DEFAULT 0 NOT NULL,
    allowed_parent_types varchar(255),

    picto               varchar(64),
    color               varchar(8),

    is_system           tinyint DEFAULT 0 NOT NULL,

    position            integer DEFAULT 0,
    active              tinyint DEFAULT 1 NOT NULL,

    date_creation       datetime,
    tms                 timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
    fk_user_creat       integer,
    fk_user_modif       integer,
    import_key          varchar(14)
) ENGINE=innodb;
