-- Finnish Chart of Accounts Structure
-- Following Finnish accounting standards and numbering system

-- Disable foreign key checks temporarily
SET FOREIGN_KEY_CHECKS = 0;

-- Clear existing data
TRUNCATE TABLE chart_of_accounts;

-- Re-enable foreign key checks
SET FOREIGN_KEY_CHECKS = 1;

-- ASSETS (VASTA-OMAISUUS) - 1000-1999
INSERT INTO chart_of_accounts (account_number, account_name, account_type, description, opening_balance, current_balance, vat_percentage, is_active) VALUES ('1000', 'Käyttöpääoma', 'asset', 'Pääomaisuus', 0.00, 0.00, 0.00, 1);
INSERT INTO chart_of_accounts (account_number, account_name, account_type, description, opening_balance, current_balance, vat_percentage, is_active) VALUES ('1100', 'Saamiset ja vaatimukset', 'asset', 'Tase-erät ja poistot', 0.00, 0.00, 0.00, 1);
INSERT INTO chart_of_accounts (account_number, account_name, account_type, description, opening_balance, current_balance, vat_percentage, is_active) VALUES ('1200', 'Aineelliset vaihto-omaisuudet', 'asset', 'Varasto ja raaka-aineet', 0.00, 0.00, 24.00, 1);
INSERT INTO chart_of_accounts (account_number, account_name, account_type, description, opening_balance, current_balance, vat_percentage, is_active) VALUES ('1300', 'Pitkän aikaiset sijoitukset', 'asset', 'Pitkän aikaiset sijoitukset', 0.00, 0.00, 0.00, 1);
INSERT INTO chart_of_accounts (account_number, account_name, account_type, description, opening_balance, current_balance, vat_percentage, is_active) VALUES ('1400', 'Kiinteistöt', 'asset', 'Kiinteistöt ja rakennukset', 0.00, 0.00, 0.00, 1);
INSERT INTO chart_of_accounts (account_number, account_name, account_type, description, opening_balance, current_balance, vat_percentage, is_active) VALUES ('1500', 'Koneet ja kalusto', 'asset', 'Koneet, kalusto ja laitteet', 0.00, 0.00, 24.00, 1);
INSERT INTO chart_of_accounts (account_number, account_name, account_type, description, opening_balance, current_balance, vat_percentage, is_active) VALUES ('1600', 'Aineettomat varat', 'asset', 'Aineettomat varat', 0.00, 0.00, 0.00, 1);
INSERT INTO chart_of_accounts (account_number, account_name, account_type, description, opening_balance, current_balance, vat_percentage, is_active) VALUES ('1700', 'Sijoitukset rahoituslaitoksissa', 'asset', 'Rahoituslaitokset', 0.00, 0.00, 0.00, 1);
INSERT INTO chart_of_accounts (account_number, account_name, account_type, description, opening_balance, current_balance, vat_percentage, is_active) VALUES ('1800', 'Erityiset vaihto-omaisuudet', 'asset', 'Erityiset vaihto-omaisuudet', 0.00, 0.00, 0.00, 1);
INSERT INTO chart_of_accounts (account_number, account_name, account_type, description, opening_balance, current_balance, vat_percentage, is_active) VALUES ('1900', 'Vaihto-omaisuudet luovutukseen', 'asset', 'Myyntikohteiset varat', 0.00, 0.00, 0.00, 1);

-- LIABILITIES (VELAT) - 2000-2999
INSERT INTO chart_of_accounts (account_number, account_name, account_type, description, opening_balance, current_balance, vat_percentage, is_active) VALUES ('2000', 'Oma pääoma', 'liability', 'Oma pääoma', 0.00, 0.00, 0.00, 1);
INSERT INTO chart_of_accounts (account_number, account_name, account_type, description, opening_balance, current_balance, vat_percentage, is_active) VALUES ('2100', 'Pitkän aikaiset velat', 'liability', 'Pitkän aikaiset velat', 0.00, 0.00, 0.00, 1);
INSERT INTO chart_of_accounts (account_number, account_name, account_type, description, opening_balance, current_balance, vat_percentage, is_active) VALUES ('2200', 'Verovelat', 'liability', 'Verovelat ja vakuudet', 0.00, 0.00, 0.00, 1);
INSERT INTO chart_of_accounts (account_number, account_name, account_type, description, opening_balance, current_balance, vat_percentage, is_active) VALUES ('2300', 'Ostovelat ja saamiset', 'liability', 'Ostovelat ja saamiset', 0.00, 0.00, 0.00, 1);
INSERT INTO chart_of_accounts (account_number, account_name, account_type, description, opening_balance, current_balance, vat_percentage, is_active) VALUES ('2400', 'Maksuvelat ja ennakot', 'liability', 'Maksuvelat ja saadut ennakot', 0.00, 0.00, 0.00, 1);
INSERT INTO chart_of_accounts (account_number, account_name, account_type, description, opening_balance, current_balance, vat_percentage, is_active) VALUES ('2500', 'Verovelat konserneille', 'liability', 'Verovelat konserneille', 0.00, 0.00, 0.00, 1);
INSERT INTO chart_of_accounts (account_number, account_name, account_type, description, opening_balance, current_balance, vat_percentage, is_active) VALUES ('2600', 'Muut velat', 'liability', 'Muut velat', 0.00, 0.00, 0.00, 1);
INSERT INTO chart_of_accounts (account_number, account_name, account_type, description, opening_balance, current_balance, vat_percentage, is_active) VALUES ('2700', 'Siirrot konserninointiin', 'liability', 'Siirrot konserninointiin', 0.00, 0.00, 0.00, 1);
INSERT INTO chart_of_accounts (account_number, account_name, account_type, description, opening_balance, current_balance, vat_percentage, is_active) VALUES ('2800', 'Tilikaudin tuloverot', 'liability', 'Tilikaudin tuloverot', 0.00, 0.00, 0.00, 1);

-- EQUITY (OMA PÄÄOMA) - 3000-3999
INSERT INTO chart_of_accounts (account_number, account_name, account_type, description, opening_balance, current_balance, vat_percentage, is_active) VALUES ('3000', 'Osakepääoma', 'equity', 'Osakepääoma', 0.00, 0.00, 0.00, 1);
INSERT INTO chart_of_accounts (account_number, account_name, account_type, description, opening_balance, current_balance, vat_percentage, is_active) VALUES ('3100', 'Sijoitetun pääoman rahastot', 'equity', 'Sijoitetun pääoman rahastot', 0.00, 0.00, 0.00, 1);
INSERT INTO chart_of_accounts (account_number, account_name, account_type, description, opening_balance, current_balance, vat_percentage, is_active) VALUES ('3200', 'Muut pääomat rahastot', 'equity', 'Muut pääomat rahastot', 0.00, 0.00, 0.00, 1);
INSERT INTO chart_of_accounts (account_number, account_name, account_type, description, opening_balance, current_balance, vat_percentage, is_active) VALUES ('3300', 'Tilikauden voitto', 'equity', 'Tilikauden voitto/tappio', 0.00, 0.00, 0.00, 1);

-- REVENUE (TUOTOT) - 4000-4999
INSERT INTO chart_of_accounts (account_number, account_name, account_type, description, opening_balance, current_balance, vat_percentage, is_active) VALUES ('4000', 'Myyntituotot', 'revenue', 'Myyntituotot', 0.00, 0.00, 24.00, 1);
INSERT INTO chart_of_accounts (account_number, account_name, account_type, description, opening_balance, current_balance, vat_percentage, is_active) VALUES ('4100', 'Palvelutuotot', 'revenue', 'Palvelutuotot', 0.00, 0.00, 24.00, 1);
INSERT INTO chart_of_accounts (account_number, account_name, account_type, description, opening_balance, current_balance, vat_percentage, is_active) VALUES ('4200', 'Vuokratuotot', 'revenue', 'Vuokratuotot', 0.00, 0.00, 24.00, 1);
INSERT INTO chart_of_accounts (account_number, account_name, account_type, description, opening_balance, current_balance, vat_percentage, is_active) VALUES ('4300', 'Korko- ja valuuttatuotot', 'revenue', 'Korko- ja valuuttatuotot', 0.00, 0.00, 0.00, 1);
INSERT INTO chart_of_accounts (account_number, account_name, account_type, description, opening_balance, current_balance, vat_percentage, is_active) VALUES ('4400', 'Muu tuotto', 'revenue', 'Muu tuotto', 0.00, 0.00, 0.00, 1);
INSERT INTO chart_of_accounts (account_number, account_name, account_type, description, opening_balance, current_balance, vat_percentage, is_active) VALUES ('4500', 'Siirrot konserninointiin', 'revenue', 'Siirrot konserninointiin', 0.00, 0.00, 0.00, 1);

-- EXPENSES (KULUT) - 5000-5999
INSERT INTO chart_of_accounts (account_number, account_name, account_type, description, opening_balance, current_balance, vat_percentage, is_active) VALUES ('5000', 'Aineelliset kulut', 'expense', 'Aineelliset kulut ja palvelut', 0.00, 0.00, 24.00, 1);
INSERT INTO chart_of_accounts (account_number, account_name, account_type, description, opening_balance, current_balance, vat_percentage, is_active) VALUES ('5100', 'Henkilöstökulut', 'expense', 'Henkilöstökulut', 0.00, 0.00, 0.00, 1);
INSERT INTO chart_of_accounts (account_number, account_name, account_type, description, opening_balance, current_balance, vat_percentage, is_active) VALUES ('5200', 'Poistot ja alennukset', 'expense', 'Poistot ja alennukset', 0.00, 0.00, 0.00, 1);
INSERT INTO chart_of_accounts (account_number, account_name, account_type, description, opening_balance, current_balance, vat_percentage, is_active) VALUES ('5300', 'Vuokrat ja vuokrakulut', 'expense', 'Vuokrat ja vuokrakulut', 0.00, 0.00, 0.00, 1);
INSERT INTO chart_of_accounts (account_number, account_name, account_type, description, opening_balance, current_balance, vat_percentage, is_active) VALUES ('5400', 'Korko- ja rahoituskulut', 'expense', 'Korko- ja rahoituskulut', 0.00, 0.00, 0.00, 1);
INSERT INTO chart_of_accounts (account_number, account_name, account_type, description, opening_balance, current_balance, vat_percentage, is_active) VALUES ('5500', 'Tase-erät ja poistot', 'expense', 'Tase-erät ja poistot', 0.00, 0.00, 0.00, 1);
INSERT INTO chart_of_accounts (account_number, account_name, account_type, description, opening_balance, current_balance, vat_percentage, is_active) VALUES ('5600', 'Arvonmäärityksen alennukset', 'expense', 'Arvonmäärityksen alennukset', 0.00, 0.00, 0.00, 1);
INSERT INTO chart_of_accounts (account_number, account_name, account_type, description, opening_balance, current_balance, vat_percentage, is_active) VALUES ('5700', 'Verotukset ja maksut', 'expense', 'Verotukset ja maksut', 0.00, 0.00, 0.00, 1);
INSERT INTO chart_of_accounts (account_number, account_name, account_type, description, opening_balance, current_balance, vat_percentage, is_active) VALUES ('5800', 'Muut kulut', 'expense', 'Muut kulut', 0.00, 0.00, 0.00, 1);
INSERT INTO chart_of_accounts (account_number, account_name, account_type, description, opening_balance, current_balance, vat_percentage, is_active) VALUES ('5900', 'Siirrot konserninointiin', 'expense', 'Siirrot konserninointiin', 0.00, 0.00, 0.00, 1);
