CREATE TABLE IF NOT EXISTS studios (
    id INT PRIMARY KEY AUTO_INCREMENT,
    user_id INT,
    slug VARCHAR(255) UNIQUE NOT NULL,
    name VARCHAR(255) NOT NULL,
    legal_name VARCHAR(255),
    description_lv TEXT,
    description_ru TEXT,
    description_en TEXT,
    city_id INT NOT NULL,
    district_id INT,
    address VARCHAR(500) NOT NULL,
    lat DECIMAL(10,7),
    lng DECIMAL(10,7),
    phone VARCHAR(50),
    email VARCHAR(255),
    website VARCHAR(500),
    facebook VARCHAR(500),
    instagram VARCHAR(500),
    tiktok VARCHAR(500),
    youtube VARCHAR(500),
    google_profile VARCHAR(500),
    price_segment ENUM('low', 'mid', 'premium') DEFAULT 'mid',
    rating DECIMAL(2,1) DEFAULT 0,
    reviews_count INT DEFAULT 0,
    working_hours JSON,
    logo VARCHAR(500),
    cover_image VARCHAR(500),
    is_claimed TINYINT(1) DEFAULT 0,
    is_verified TINYINT(1) DEFAULT 0,
    is_featured TINYINT(1) DEFAULT 0,
    is_active TINYINT(1) DEFAULT 1,
    created_at DATETIME DEFAULT CURRENT_TIMESTAMP,
    updated_at DATETIME DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
    FOREIGN KEY (user_id) REFERENCES users(id) ON DELETE SET NULL,
    FOREIGN KEY (city_id) REFERENCES cities(id),
    FOREIGN KEY (district_id) REFERENCES districts(id) ON DELETE SET NULL,
    INDEX idx_city (city_id),
    INDEX idx_district (district_id),
    INDEX idx_rating (rating),
    INDEX idx_segment (price_segment),
    INDEX idx_active (is_active),
    FULLTEXT INDEX ft_name (name)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
