-- phpMyAdmin SQL Dump
-- version 5.2.1
-- https://www.phpmyadmin.net/
--
-- Host: 127.0.0.1:3306
-- Generation Time: Mar 15, 2026 at 07:02 PM
-- Server version: 8.2.0
-- PHP Version: 8.2.13

SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
START TRANSACTION;

/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8mb4 */;

--
-- Database: `padel2026`
--
CREATE DATABASE IF NOT EXISTS `padel2026` DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci;
USE `padel2026`;

-- --------------------------------------------------------
-- Table structure for table `klubovi`
--
DROP TABLE IF EXISTS `klubovi`;
CREATE TABLE IF NOT EXISTS `klubovi` (
  `id` int NOT NULL AUTO_INCREMENT,
  `naziv` varchar(100) NOT NULL,
  PRIMARY KEY (`id`)
) ENGINE=MyISAM AUTO_INCREMENT=4 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;

INSERT INTO `klubovi` (`id`, `naziv`) VALUES
(1, 'Padel Arena'),
(2, 'Padel Center'),
(3, 'Padel Beograd');

-- --------------------------------------------------------
-- Table structure for table `korisnici`
--
DROP TABLE IF EXISTS `korisnici`;
CREATE TABLE IF NOT EXISTS `korisnici` (
  `kor_ime` varchar(50) NOT NULL,
  `ime` varchar(50) NOT NULL,
  `prezime` varchar(50) NOT NULL,
  `lozinka` varchar(100) NOT NULL,
  `mejl` varchar(100) NOT NULL,
  `tip` varchar(20) NOT NULL,
  PRIMARY KEY (`kor_ime`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;

INSERT INTO `korisnici` (`kor_ime`, `ime`, `prezime`, `lozinka`, `mejl`, `tip`) VALUES
('admin1', 'Marko', 'Markovic', 'admin123', 'admin1@mail.com', 'administrator'),
('admin2', 'Jelena', 'Jovanovic', 'admin123', 'admin2@mail.com', 'administrator'),
('igrac1', 'Petar', 'Petrovic', '123', 'petar@mail.com', 'igrac'),
('igrac2', 'Nikola', 'Nikolic', '123', 'nikola@mail.com', 'igrac'),
('igrac3', 'Ana', 'Anic', '123', 'ana@mail.com', 'igrac'),
('igrac4', 'Milan', 'Milic', '123', 'milan@mail.com', 'igrac');

-- --------------------------------------------------------
-- Table structure for table `rezervacije` sa DATETIME kolonom
--
DROP TABLE IF EXISTS `rezervacije`;
CREATE TABLE IF NOT EXISTS `rezervacije` (
  `id` int NOT NULL AUTO_INCREMENT,
  `teren_id` int NOT NULL,
  `kor_ime` varchar(50) NOT NULL,
  `vreme_rezervacije` datetime NOT NULL,
  `potrebni_igraci` int DEFAULT '0',
  `status` varchar(20) DEFAULT 'nova',
  PRIMARY KEY (`id`),
  KEY `teren_id` (`teren_id`),
  KEY `kor_ime` (`kor_ime`)
) ENGINE=MyISAM AUTO_INCREMENT=4 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;

INSERT INTO `rezervacije` (`id`, `teren_id`, `kor_ime`, `vreme_rezervacije`, `potrebni_igraci`, `status`) VALUES
(1, 1, 'igrac1', '2026-04-10 18:00:00', 2, 'prihvacena'),
(2, 2, 'igrac2', '2026-04-11 19:00:00', 0, 'prihvacena'),
(3, 4, 'igrac3', '2026-04-12 20:00:00', 1, 'nova');

-- --------------------------------------------------------
-- Table structure for table `tereni`
--
DROP TABLE IF EXISTS `tereni`;
CREATE TABLE IF NOT EXISTS `tereni` (
  `id` int NOT NULL AUTO_INCREMENT,
  `klub_id` int NOT NULL,
  `oznaka` varchar(50) NOT NULL,
  PRIMARY KEY (`id`),
  KEY `klub_id` (`klub_id`)
) ENGINE=MyISAM AUTO_INCREMENT=8 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;

INSERT INTO `tereni` (`id`, `klub_id`, `oznaka`) VALUES
(1, 1, 'Teren 1'),
(2, 1, 'Teren 2'),
(3, 1, 'Teren 3'),
(4, 2, 'Teren 1'),
(5, 2, 'Teren 2'),
(6, 3, 'Teren A'),
(7, 3, 'Teren B');

-- --------------------------------------------------------
-- Table structure for table `ucesnici_rezervacije`
--
DROP TABLE IF EXISTS `ucesnici_rezervacije`;
CREATE TABLE IF NOT EXISTS `ucesnici_rezervacije` (
  `id` int NOT NULL AUTO_INCREMENT,
  `rezervacija_id` int NOT NULL,
  `kor_ime` varchar(50) NOT NULL,
  PRIMARY KEY (`id`),
  UNIQUE KEY `rezervacija_id` (`rezervacija_id`,`kor_ime`),
  KEY `kor_ime` (`kor_ime`)
) ENGINE=MyISAM AUTO_INCREMENT=3 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;

INSERT INTO `ucesnici_rezervacije` (`id`, `rezervacija_id`, `kor_ime`) VALUES
(1, 1, 'igrac2'),
(2, 1, 'igrac3');

COMMIT;

/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;