diff --git a/.idea/caches/deviceStreaming.xml b/.idea/caches/deviceStreaming.xml
new file mode 100644
index 00000000..51d2b618
--- /dev/null
+++ b/.idea/caches/deviceStreaming.xml
@@ -0,0 +1,1258 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/misc.xml b/.idea/misc.xml
index 9c8e7400..52b96137 100644
--- a/.idea/misc.xml
+++ b/.idea/misc.xml
@@ -1,6 +1,6 @@
-
+
\ No newline at end of file
diff --git a/src/main/kotlin/Archive.kt b/src/main/kotlin/Archive.kt
new file mode 100644
index 00000000..2a368648
--- /dev/null
+++ b/src/main/kotlin/Archive.kt
@@ -0,0 +1,3 @@
+class Archive(val name: String) {
+ val notes = mutableListOf()
+}
\ No newline at end of file
diff --git a/src/main/kotlin/Main.kt b/src/main/kotlin/Main.kt
index aade54c5..bcb35af3 100644
--- a/src/main/kotlin/Main.kt
+++ b/src/main/kotlin/Main.kt
@@ -1,3 +1,131 @@
-fun main(args: Array) {
- println("Hello World!")
+import java.util.Scanner
+
+val archives = mutableListOf()
+val scanner = Scanner(System.`in`)
+
+fun main() {
+ val archiveMenu = Menu("Архивы")
+
+ archiveMenu.addOption("Создать архив") {
+ createArchive()
+ }
+
+ archiveMenu.addOption("Выбрать архив") {
+ chooseArchive()
+ }
+
+ archiveMenu.show()
+}
+
+fun createArchive() {
+ println("\n=== Создание архива ===")
+ print("Введите название архива: ")
+ val name = scanner.nextLine().trim()
+
+ if (name.isEmpty()) {
+ println("Ошибка: название не может быть пустым")
+ return
+ }
+
+ archives.add(Archive(name))
+ println("Архив '$name' создан")
+}
+
+fun chooseArchive() {
+ selectFromList(
+ title = "Выбор архива",
+ items = archives,
+ itemToString = { it.name },
+ onSelect = { archive ->
+ showNotesMenu(archive)
+ }
+ )
+}
+
+fun showNotesMenu(archive: Archive) {
+ val notesMenu = Menu("Заметки архива: ${archive.name}")
+
+ notesMenu.addOption("Создать заметку") {
+ createNote(archive)
+ }
+
+ notesMenu.addOption("Просмотреть заметки") {
+ chooseNote(archive)
+ }
+
+ notesMenu.show()
+}
+
+fun createNote(archive: Archive) {
+ println("\n=== Создание заметки ===")
+
+ print("Введите заголовок заметки: ")
+ val title = scanner.nextLine().trim()
+
+ if (title.isEmpty()) {
+ println("Ошибка: заголовок не может быть пустым")
+ return
+ }
+
+ print("Введите содержание заметки: ")
+ val content = scanner.nextLine().trim()
+
+ if (content.isEmpty()) {
+ println("Ошибка: содержание не может быть пустым")
+ return
+ }
+
+ archive.notes.add(Note(title, content))
+ println("Заметка '$title' создана")
+}
+
+fun chooseNote(archive: Archive) {
+ selectFromList(
+ title = "Выбор заметки",
+ items = archive.notes,
+ itemToString = { it.title },
+ onSelect = { note ->
+ showNoteContent(note)
+ }
+ )
+}
+
+fun showNoteContent(note: Note) {
+ println("\n=== ${note.title} ===")
+ println(note.content)
+ println("\nНажмите Enter для возврата...")
+ scanner.nextLine()
+}
+
+fun selectFromList(
+ title: String,
+ items: List,
+ itemToString: (T) -> String,
+ onSelect: (T) -> Unit
+) {
+ if (items.isEmpty()) {
+ println("Список пуст")
+ return
+ }
+
+ println("\n=== $title ===")
+ items.forEachIndexed { index, item ->
+ println("$index. ${itemToString(item)}")
+ }
+ println("${items.size}. Назад")
+
+ print("Выберите пункт: ")
+ val input = scanner.nextLine()
+
+ if (input == items.size.toString()) {
+ return
+ }
+
+ val choice = input.toIntOrNull()
+ if (choice == null || choice !in items.indices) {
+ println("Ошибка: введите число от 0 до ${items.size - 1}")
+ return
+ }
+
+ onSelect(items[choice])
}
\ No newline at end of file
diff --git a/src/main/kotlin/Menu.kt b/src/main/kotlin/Menu.kt
new file mode 100644
index 00000000..c5c6faf3
--- /dev/null
+++ b/src/main/kotlin/Menu.kt
@@ -0,0 +1,36 @@
+import java.util.Scanner
+
+class Menu(val title: String) {
+ private val options = mutableListOf Unit>>()
+ private val scanner = Scanner(System.`in`)
+
+ fun addOption(name: String, action: () -> Unit) {
+ options.add(Pair(name, action))
+ }
+
+ fun show() {
+ while (true) {
+ println("\n=== $title ===")
+ options.forEachIndexed { index, (name, _) ->
+ println("$index. $name")
+ }
+ println("${options.size}. Выход")
+
+ print("Выберите пункт: ")
+ val input = scanner.nextLine()
+
+ if (input == options.size.toString()) {
+ println("Выход...")
+ break
+ }
+
+ val choice = input.toIntOrNull()
+ if (choice == null || choice !in options.indices) {
+ println("Ошибка: введите число от 0 до ${options.size - 1}")
+ continue
+ }
+
+ options[choice].second.invoke()
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/main/kotlin/Note.kt b/src/main/kotlin/Note.kt
new file mode 100644
index 00000000..0307e6fe
--- /dev/null
+++ b/src/main/kotlin/Note.kt
@@ -0,0 +1 @@
+class Note(val title: String, val content: String)
\ No newline at end of file
diff --git a/src/main/kotlin/Screen.kt b/src/main/kotlin/Screen.kt
new file mode 100644
index 00000000..9d58f185
--- /dev/null
+++ b/src/main/kotlin/Screen.kt
@@ -0,0 +1,32 @@
+import java.util.Scanner
+
+class Screen(val title: String, val options: List Unit>>) {
+
+ private val scanner = Scanner(System.`in`)
+
+ fun show() {
+ while (true) {
+ println("\n=== $title ===")
+ options.forEachIndexed { index, option ->
+ println("$index. ${option.first}")
+ }
+ println("${options.size}. Выход")
+
+ print("Выберите пункт: ")
+ val input = scanner.nextLine()
+
+ if (input == options.size.toString()) {
+ println("Выход...")
+ break
+ }
+
+ val choice = input.toIntOrNull()
+ if (choice == null || choice !in options.indices) {
+ println("Ошибка: введите число от 0 до ${options.size - 1}")
+ continue
+ }
+
+ options[choice].second.invoke()
+ }
+ }
+}
\ No newline at end of file