--
-- XBRL Report tables
--
CREATE TABLE IF NOT EXISTS `_XBRLReports` (
    `_id` int(11) NOT NULL AUTO_INCREMENT,
    `_accYearStart` date NOT NULL,
    `_accYearEnd` date NOT NULL,
    `_orgNo` varchar(255) NOT NULL,
    `_reportType` enum('k2') NOT NULL DEFAULT 'k2',
    `_version` varchar(255) NOT NULL,
    `_language` varchar(5) NOT NULL DEFAULT 'sv',
    PRIMARY KEY (`_id`),
    KEY `_orgNo` (`_orgNo`),
    KEY `_reportType` (`_reportType`),
    KEY `_version` (`_version`)
) ENGINE = MyISAM DEFAULT CHARSET = utf8;
CREATE TABLE IF NOT EXISTS `_XBRLReportElements` (
    `_id` int(11) NOT NULL AUTO_INCREMENT,
    `_reportID` int(11) NOT NULL,
    `_name` varchar(255) NOT NULL,
    `_value` varchar(255) NOT NULL,
    `_contextRef` varchar(255) NOT NULL,
    `_unitRef` varchar(255) NOT NULL,
    `_decimals` varchar(5) NOT NULL DEFAULT 'INF',
    `_isTuple` tinyint(1) NOT NULL DEFAULT '0',
    `_parentID` int(11) NOT NULL DEFAULT '0',
    `_parentName` varchar(255) NOT NULL DEFAULT '',
    `_noteRef` varchar(255) NOT NULL DEFAULT '',
    `_index` int(11) NOT NULL DEFAULT '0',
    PRIMARY KEY (`_id`),
    KEY `_reportID` (`_reportID`),
    KEY `_contextRef` (`_contextRef`),
    KEY `_name` (`_name`),
    KEY `_index` (`_index`)
) ENGINE = MyISAM DEFAULT CHARSET = utf8;
CREATE TABLE IF NOT EXISTS `_XBRLReportContexts` (
    `_reportID` int(11) NOT NULL,
    `_contextID` varchar(255) NOT NULL,
    `_entityIdentifier` varchar(255) NOT NULL,
    `_entityScheme` varchar(255) NOT NULL,
    `_periodType` enum('duration', 'instant', 'forever') NOT NULL DEFAULT 'duration',
    `_periodStartDate` date NOT NULL DEFAULT '0000-00-00',
    `_periodEndDate` date NOT NULL DEFAULT '0000-00-00',
    `_periodInstant` date NOT NULL DEFAULT '0000-00-00',
    `_index` int(11) NOT NULL DEFAULT '0',
    PRIMARY KEY (`_reportID`, `_contextID`),
    KEY `_index` (`_index`)
) ENGINE = MyISAM DEFAULT CHARSET = utf8;
CREATE TABLE IF NOT EXISTS `_XBRLReportUnits` (
    `_reportID` int(11) NOT NULL,
    `_unitID` varchar(255) NOT NULL,
    `_measure` varchar(255) NOT NULL,
    `_index` int(11) NOT NULL DEFAULT '0',
    PRIMARY KEY (`_reportID`, `_unitID`),
    KEY `_index` (`_index`)
) ENGINE = MyISAM DEFAULT CHARSET = utf8;
--
-- XBRL Taxonomy tables
--
CREATE TABLE IF NOT EXISTS `_XBRLTaxonomies` (
    `_id` int(11) NOT NULL AUTO_INCREMENT,
    `_reportType` varchar(255) NOT NULL,
    `_version` varchar(255) NOT NULL,
    `_revision` varchar(255) NOT NULL,
    `_isFinal` tinyint(1) NOT NULL DEFAULT '1',
    `_language` varchar(255) NOT NULL DEFAULT 'sv',
    PRIMARY KEY (`_id`),
    KEY `_reportType` (`_reportType`),
    KEY `_version` (`_version`)
) ENGINE = MyISAM DEFAULT CHARSET = utf8;
CREATE TABLE IF NOT EXISTS `_XBRLTaxonomyElements` (
    `_xbrlTaxonomyID` int(11) NOT NULL,
    `_section` varchar(255) NOT NULL,
    `_id` int(11) NOT NULL AUTO_INCREMENT,
    `_rowID` int(11) NOT NULL,
    `_rowNo` int(11) NOT NULL,
    `_rowLabel` varchar(255) NOT NULL,
    `_rowLabelAlt` text NOT NULL,
    `_elementName` varchar(255) NOT NULL,
    `_from` varchar(255) NOT NULL,
    `_standardLabel` varchar(255) NOT NULL,
    `_isAbstract` tinyint(1) NOT NULL DEFAULT '0',
    `_dataType` varchar(255) NOT NULL,
    `_balance` varchar(255) NOT NULL,
    `_periodType` enum('duration', 'instant', 'forever', 'na') NOT NULL DEFAULT 'duration',
    `_type` varchar(255) NOT NULL,
    `_documentation` text,
    `_extendedDocumentation` text,
    `_parentID` int(11) NOT NULL DEFAULT '0',
    `_level` int(11) NOT NULL DEFAULT '0',
    `_parentTree` varchar(255) NOT NULL DEFAULT '',
    PRIMARY KEY (`_id`),
    KEY `_section` (`_section`),
    KEY `_xbrlTaxonomyID` (`_xbrlTaxonomyID`),
    KEY `_elementName` (`_elementName`),
    KEY `_rowLabel` (`_rowLabel`)
) ENGINE = MyISAM DEFAULT CHARSET = utf8;