CREATE TABLE IF NOT EXISTS `up_and_down`.`numbers` (
                                                       `n` INT NOT NULL PRIMARY KEY
);

INSERT INTO `up_and_down`.`numbers` (`n`)
VALUES (1),(2),(3),(4),(5),(6),(7),(8),(9),(10),
       (11),(12),(13),(14),(15),(16),(17),(18),(19),(20);

INSERT INTO `up_and_down`.`diaries` (
    `uuid`,
    `user_uuid`,
    `time`,
    `mania_level`,
    `depression_level`,
    `mood_level`,
    `activity_level`,
    `appetite_level`,
    `dream_level`,
    `anxiety_level`,
    `comment`,
    `user_treatment_schemes_uuid`
)
SELECT
    UUID() AS uuid,
    uts.user_uuid,
    DATE_ADD(TIMESTAMP('2025-01-01 08:00:00'), INTERVAL n.n DAY) AS time,

    -- уровни от 1 до 10, чуть "перемешанные" через арифметику
    ((n.n * 3) % 10) + 1 AS mania_level,
    ((n.n * 5) % 10) + 1 AS depression_level,
    ((n.n * 7) % 10) + 1 AS mood_level,
    ((n.n * 2) % 10) + 1 AS activity_level,
    ((n.n * 4) % 10) + 1 AS appetite_level,
    ((n.n * 6) % 10) + 1 AS dream_level,
    ((n.n * 8) % 10) + 1 AS anxiety_level,

    CONCAT('Auto-generated diary entry #', n.n,
           ' for treatment scheme ', uts.uuid) AS comment,

    uts.uuid AS user_treatment_schemes_uuid
FROM `up_and_down`.`user_treatment_schemes` uts
    JOIN `up_and_down`.`numbers` n ON 1=1;
