-- FFL FULL INSTALL — jedan import u bazu enwubfis_ffl

-- CreateTable
CREATE TABLE `site_settings` (
    `id` INTEGER NOT NULL DEFAULT 1,
    `phone` VARCHAR(50) NOT NULL,
    `phone_alt` VARCHAR(50) NULL,
    `email` VARCHAR(191) NOT NULL,
    `address` VARCHAR(255) NOT NULL,
    `facebook_url` VARCHAR(255) NULL,
    `instagram_url` VARCHAR(255) NULL,
    `company_name` VARCHAR(255) NOT NULL,
    `company_oib` VARCHAR(20) NULL,
    `company_person` VARCHAR(120) NULL,
    `company_seat` VARCHAR(255) NULL,
    `seo_title` VARCHAR(160) NOT NULL,
    `seo_description` TEXT NOT NULL,
    `footer_text` VARCHAR(255) NULL,
    `updated_at` DATETIME(3) NOT NULL,

    PRIMARY KEY (`id`)
) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;

-- CreateTable
CREATE TABLE `page_contents` (
    `id` INTEGER NOT NULL AUTO_INCREMENT,
    `slug` VARCHAR(80) NOT NULL,
    `title` VARCHAR(160) NOT NULL,
    `headline` VARCHAR(255) NULL,
    `body` LONGTEXT NOT NULL,
    `published` BOOLEAN NOT NULL DEFAULT true,
    `updated_at` DATETIME(3) NOT NULL,

    UNIQUE INDEX `page_contents_slug_key`(`slug`),
    PRIMARY KEY (`id`)
) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;

-- CreateTable
CREATE TABLE `trainers` (
    `id` INTEGER NOT NULL AUTO_INCREMENT,
    `slug` VARCHAR(80) NOT NULL,
    `name` VARCHAR(120) NOT NULL,
    `role` VARCHAR(160) NULL,
    `bio` LONGTEXT NOT NULL,
    `quote` TEXT NULL,
    `photo_path` VARCHAR(255) NULL,
    `specialties` VARCHAR(255) NULL,
    `website_url` VARCHAR(255) NULL,
    `sort_order` INTEGER NOT NULL DEFAULT 0,
    `published` BOOLEAN NOT NULL DEFAULT true,
    `created_at` DATETIME(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3),
    `updated_at` DATETIME(3) NOT NULL,

    UNIQUE INDEX `trainers_slug_key`(`slug`),
    PRIMARY KEY (`id`)
) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;

-- CreateTable
CREATE TABLE `schedule_entries` (
    `id` INTEGER NOT NULL AUTO_INCREMENT,
    `day_of_week` INTEGER NOT NULL,
    `start_time` VARCHAR(5) NOT NULL,
    `end_time` VARCHAR(5) NULL,
    `title` VARCHAR(160) NOT NULL,
    `level` VARCHAR(80) NULL,
    `trainer_id` INTEGER NULL,
    `sort_order` INTEGER NOT NULL DEFAULT 0,
    `published` BOOLEAN NOT NULL DEFAULT true,
    `updated_at` DATETIME(3) NOT NULL,

    INDEX `schedule_entries_day_of_week_start_time_idx`(`day_of_week`, `start_time`),
    PRIMARY KEY (`id`)
) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;

-- CreateTable
CREATE TABLE `pricing_categories` (
    `id` INTEGER NOT NULL AUTO_INCREMENT,
    `name` VARCHAR(120) NOT NULL,
    `note` TEXT NULL,
    `sort_order` INTEGER NOT NULL DEFAULT 0,
    `published` BOOLEAN NOT NULL DEFAULT true,

    PRIMARY KEY (`id`)
) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;

-- CreateTable
CREATE TABLE `pricing_items` (
    `id` INTEGER NOT NULL AUTO_INCREMENT,
    `category_id` INTEGER NOT NULL,
    `label` VARCHAR(160) NOT NULL,
    `price` VARCHAR(40) NOT NULL,
    `sort_order` INTEGER NOT NULL DEFAULT 0,
    `published` BOOLEAN NOT NULL DEFAULT true,

    INDEX `pricing_items_category_id_idx`(`category_id`),
    PRIMARY KEY (`id`)
) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;

-- CreateTable
CREATE TABLE `gallery_images` (
    `id` INTEGER NOT NULL AUTO_INCREMENT,
    `album` VARCHAR(80) NOT NULL DEFAULT 'o-nama',
    `path` VARCHAR(255) NOT NULL,
    `caption` VARCHAR(255) NULL,
    `sort_order` INTEGER NOT NULL DEFAULT 0,
    `published` BOOLEAN NOT NULL DEFAULT true,
    `created_at` DATETIME(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3),

    INDEX `gallery_images_album_sort_order_idx`(`album`, `sort_order`),
    PRIMARY KEY (`id`)
) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;

-- AddForeignKey
ALTER TABLE `schedule_entries` ADD CONSTRAINT `schedule_entries_trainer_id_fkey` FOREIGN KEY (`trainer_id`) REFERENCES `trainers`(`id`) ON DELETE SET NULL ON UPDATE CASCADE;

-- AddForeignKey
ALTER TABLE `pricing_items` ADD CONSTRAINT `pricing_items_category_id_fkey` FOREIGN KEY (`category_id`) REFERENCES `pricing_categories`(`id`) ON DELETE CASCADE ON UPDATE CASCADE;



-- FFL seed data
INSERT INTO site_settings (id, phone, phone_alt, email, address, facebook_url, instagram_url, company_name, company_oib, company_person, company_seat, seo_title, seo_description, footer_text, updated_at) VALUES (1, '098 9988 217', '091 798 51 79', 'info@fitfor-life.eu', 'Kumičićeva 61, Rijeka', 'https://www.facebook.com/FitforlifeRijeka/', NULL, 'Društvo sportske rekreacije Fit for Life', '92351907933', 'Kristijan Torbarac', 'Slavke Raškaj 15', 'Fit for Life | Trening centar Rijeka', 'Fit for Life trening centar specijaliziran je za programe individualnih i grupnih treninga u Rijeci.', 'Copyright © FIT for LIFE. Sva prava pridržana.', NOW(3));
INSERT INTO page_contents (slug, title, headline, body, published, updated_at) VALUES ('home', 'Naslovnica', 'BITI FIT NIJE MIT', 'Fit for Life trening centar specijaliziran je za programe individualnih i grupnih treninga. Mali broj polaznika, individualan pristup i rezultati koji se vide.', 1, NOW(3));
INSERT INTO page_contents (slug, title, headline, body, published, updated_at) VALUES ('o-nama', 'O nama', 'O nama', 'Fit for life fitness centar je specijaliziran za programe individualnih i grupnih treninga. Smješten je u neposrednoj blizini Tete Rože, u atraktivnom dvoetažnom prostoru od 300 m².

## Dvorana
• Prostor od 300 m² na dvije etaže
• Privatni parking (20 mjesta)
• Dvije dvorane opremljene najsuvremenijim spravama Panatta Sport
• Prostrane i potpuno nove svlačionice s tuševima', 1, NOW(3));
INSERT INTO page_contents (slug, title, headline, body, published, updated_at) VALUES ('grupni-treninzi', 'Grupni treninzi', 'Grupni treninzi', 'Grupni treninzi odlični su za one kojima se je teško natjerati da treniraju sami.

## Programi
• Funkcionalni kružni trening (60 min)
• Tabata (45–60 min)
• Abs''N''Glutes (do 60 min)
• 60+ program (do 60 min)
• Cross trening', 1, NOW(3));
INSERT INTO page_contents (slug, title, headline, body, published, updated_at) VALUES ('individualni-treninzi', 'Individualni treninzi', 'Individualni treninzi', 'Individualni treninzi su tu kako bi se tvojim ciljevima posvetili 100%. Termine dogovaraš individualno.', 1, NOW(3));
INSERT INTO trainers (slug, name, role, bio, quote, photo_path, specialties, website_url, sort_order, published, created_at, updated_at) VALUES ('toni-beletic', 'Toni Beletić', 'Cross trening, individualni treninzi, prehrana', 'Toni vodi treninge mobilnosti, jakosti i funkcionalnosti. Dostupan i za plan prehrane.', NULL, '/media/trainers/toni_desktop.png', 'Crossfit, powerlifting, nutricionizam', 'https://tonibeletic.com/', 1, 1, NOW(3), NOW(3));
INSERT INTO trainers (slug, name, role, bio, quote, photo_path, specialties, website_url, sort_order, published, created_at, updated_at) VALUES ('ante-kapov', 'Ante Kapov', 'Individualni i fitness treninzi', 'Bivši profesionalni košarkaš. Zadnjih 9 godina trener je u Fit for Life-u.', 'U fitness svijet ulazite zbog sebe i svoga zdravlja.', '/media/trainers/ante_desktop.png', 'Fitness, kondicija', NULL, 2, 1, NOW(3), NOW(3));
INSERT INTO trainers (slug, name, role, bio, quote, photo_path, specialties, website_url, sort_order, published, created_at, updated_at) VALUES ('barbara-lipovscak', 'Barbara Lipovšćak', 'Instruktorica yoge', 'Certificirana instruktorica yoge. Od 2020. održava grupne i individualne satove.', 'Svatko ima svoj razlog dolaska na sat yoge.', '/media/trainers/barbara_desktop.png', 'Hatha, Vinyasa, Yin, Aerial', 'https://instagram.com/yoga_withb', 3, 1, NOW(3), NOW(3));
INSERT INTO trainers (slug, name, role, bio, quote, photo_path, specialties, website_url, sort_order, published, created_at, updated_at) VALUES ('morena-ladika-franciskovic', 'Morena Ladika Frančišković', 'Grupni i individualni treninzi, TRX, trčanje', 'Instruktorica grupnog fitnessa. Vodi funkcionalne, Tabata, AbsNGlutes, 60+.', 'Veni, vidi, vježbaj!', '/media/trainers/morena_desktop.png', 'Funkcionalni, Tabata, TRX, 60+', NULL, 4, 1, NOW(3), NOW(3));
INSERT INTO trainers (slug, name, role, bio, quote, photo_path, specialties, website_url, sort_order, published, created_at, updated_at) VALUES ('dora', 'Dora', 'Trenerica', 'Članica Fit for Life trenerskog tima.', NULL, '/media/trainers/dora_desktop.png', NULL, NULL, 5, 1, NOW(3), NOW(3));
SET @toni := (SELECT id FROM trainers WHERE slug='toni-beletic');
SET @morena := (SELECT id FROM trainers WHERE slug='morena-ladika-franciskovic');
INSERT INTO schedule_entries (day_of_week, start_time, end_time, title, level, trainer_id, sort_order, published, updated_at) VALUES (1, '07:00', '08:00', 'Funkcionalni kružni', 'Svi nivoi', @morena, 1, 1, NOW(3));
INSERT INTO schedule_entries (day_of_week, start_time, end_time, title, level, trainer_id, sort_order, published, updated_at) VALUES (1, '18:00', '19:00', 'Tabata', 'Svi nivoi', @morena, 2, 1, NOW(3));
INSERT INTO schedule_entries (day_of_week, start_time, end_time, title, level, trainer_id, sort_order, published, updated_at) VALUES (2, '07:00', '08:00', 'Abs''N''Glutes', 'Svi nivoi', @morena, 1, 1, NOW(3));
INSERT INTO schedule_entries (day_of_week, start_time, end_time, title, level, trainer_id, sort_order, published, updated_at) VALUES (2, '18:00', '19:00', 'Cross trening', 'Srednji/napredni', @toni, 2, 1, NOW(3));
INSERT INTO schedule_entries (day_of_week, start_time, end_time, title, level, trainer_id, sort_order, published, updated_at) VALUES (3, '07:00', '08:00', 'Funkcionalni kružni', 'Svi nivoi', @morena, 1, 1, NOW(3));
INSERT INTO schedule_entries (day_of_week, start_time, end_time, title, level, trainer_id, sort_order, published, updated_at) VALUES (3, '09:00', '10:00', '60+ program', '60+', @morena, 2, 1, NOW(3));
INSERT INTO schedule_entries (day_of_week, start_time, end_time, title, level, trainer_id, sort_order, published, updated_at) VALUES (4, '18:00', '19:00', 'Cross trening', 'Srednji/napredni', @toni, 1, 1, NOW(3));
INSERT INTO schedule_entries (day_of_week, start_time, end_time, title, level, trainer_id, sort_order, published, updated_at) VALUES (5, '07:00', '08:00', 'Tabata', 'Svi nivoi', @morena, 1, 1, NOW(3));
INSERT INTO pricing_categories (name, note, sort_order, published) VALUES ('Grupni treninzi', 'Male grupe, isti trener.', 1, 1);
SET @c1 := LAST_INSERT_ID();
INSERT INTO pricing_items (category_id, label, price, sort_order, published) VALUES (@c1,'2x tjedno','50 €',1,1),(@c1,'3x tjedno','60 €',2,1),(@c1,'4x tjedno','65 €',3,1),(@c1,'5x tjedno','70 €',4,1);
INSERT INTO pricing_categories (name, note, sort_order, published) VALUES ('Studenti – no limit', 'Jutarnji grupni.', 2, 1);
SET @c2 := LAST_INSERT_ID();
INSERT INTO pricing_items (category_id, label, price, sort_order, published) VALUES (@c2,'Grupni treninzi','45 €',1,1);
INSERT INTO pricing_categories (name, note, sort_order, published) VALUES ('Individualni i poluindividualni', 'Dogovor s trenerom.', 3, 1);
SET @c3 := LAST_INSERT_ID();
INSERT INTO pricing_items (category_id, label, price, sort_order, published) VALUES (@c3,'8 dolazaka','250 €',1,1),(@c3,'10 dolazaka','280 €',2,1),(@c3,'12 dolazaka','330 €',3,1),(@c3,'1 sat','35 €',4,1);
INSERT INTO gallery_images (album, path, caption, sort_order, published, created_at) VALUES ('o-nama', '/media/gallery/onama-fit-for-life15e1f.jpg', 'Fit for Life dvorana', 1, 1, NOW(3));
INSERT INTO gallery_images (album, path, caption, sort_order, published, created_at) VALUES ('o-nama', '/media/gallery/onama-fit-for-life25e1f.jpg', 'Fit for Life dvorana', 2, 1, NOW(3));
INSERT INTO gallery_images (album, path, caption, sort_order, published, created_at) VALUES ('o-nama', '/media/gallery/onama-fit-for-life35e1f.jpg', 'Fit for Life dvorana', 3, 1, NOW(3));
INSERT INTO gallery_images (album, path, caption, sort_order, published, created_at) VALUES ('o-nama', '/media/gallery/onama-fit-for-life45e1f.jpg', 'Fit for Life dvorana', 4, 1, NOW(3));
INSERT INTO gallery_images (album, path, caption, sort_order, published, created_at) VALUES ('o-nama', '/media/gallery/onama-fit-for-life55e1f.jpg', 'Fit for Life dvorana', 5, 1, NOW(3));
INSERT INTO gallery_images (album, path, caption, sort_order, published, created_at) VALUES ('o-nama', '/media/gallery/onama-fit-for-life65e1f.jpg', 'Fit for Life dvorana', 6, 1, NOW(3));
INSERT INTO gallery_images (album, path, caption, sort_order, published, created_at) VALUES ('o-nama', '/media/gallery/onama-fit-for-life75e1f.jpg', 'Fit for Life dvorana', 7, 1, NOW(3));
INSERT INTO gallery_images (album, path, caption, sort_order, published, created_at) VALUES ('o-nama', '/media/gallery/onama-fit-for-life85e1f.jpg', 'Fit for Life dvorana', 8, 1, NOW(3));
INSERT INTO gallery_images (album, path, caption, sort_order, published, created_at) VALUES ('o-nama', '/media/gallery/onama-fit-for-life95e1f.jpg', 'Fit for Life dvorana', 9, 1, NOW(3));
INSERT INTO gallery_images (album, path, caption, sort_order, published, created_at) VALUES ('grupni', '/media/gallery/grupni-fit-for-life1_small.jpg', 'Grupni', 1, 1, NOW(3));
INSERT INTO gallery_images (album, path, caption, sort_order, published, created_at) VALUES ('grupni', '/media/gallery/grupni-fit-for-life2_small.jpg', 'Grupni', 2, 1, NOW(3));
