cmake_minimum_required(VERSION 3.16)
project(WinoMailQt VERSION 1.0.0 LANGUAGES CXX)

set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)

find_package(Qt6 COMPONENTS Core Gui Widgets Network Sql Test Concurrent REQUIRED)

set(CMAKE_AUTOMOC ON)
set(CMAKE_AUTOUIC ON)
set(CMAKE_AUTORCC ON)

# Include directories
include_directories(${PROJECT_SOURCE_DIR})
include_directories(${PROJECT_SOURCE_DIR}/src)
include_directories(${PROJECT_SOURCE_DIR}/src/core)
include_directories(${PROJECT_SOURCE_DIR}/src/db)
include_directories(${PROJECT_SOURCE_DIR}/src/utils)
include_directories(${PROJECT_SOURCE_DIR}/src/services)
include_directories(${PROJECT_SOURCE_DIR}/src/services/gmail)
include_directories(${PROJECT_SOURCE_DIR}/src/services/outlook)
include_directories(${PROJECT_SOURCE_DIR}/src/services/imap)
include_directories(${PROJECT_SOURCE_DIR}/src/services/pop3)

# Source files
set(SRC_FILES
    src/main.cpp
    src/core/translator.cpp
    src/core/mailitem.cpp
    src/core/models/account.cpp
    src/core/models/folder.cpp
    src/services/request.cpp
    src/services/concreterequests.cpp
    src/services/requestprocessor.cpp
    src/services/changetype.h
    src/services/changeprocessor.cpp
    src/services/accountservice.cpp
    src/services/mailservice.cpp
    src/services/mimestorage.cpp
    src/services/folderservice.cpp
    src/services/synchronizer.cpp
    src/services/imap/imapsynchronizer.cpp
    src/services/outlook/outlooksynchronizer.cpp
    src/services/gmail/gmailsynchronizer.cpp
    src/services/pop3/pop3synchronizer.cpp
    src/db/databasemanager.cpp
    src/db/dao/accountdao.cpp
    src/db/dao/folderdao.cpp
    src/db/dao/mailitemdao.cpp
    src/db/dbchangeprocessor.cpp
    src/core/eventbus.cpp
    src/utils/notificationmanager.cpp
    src/core/emailmanager.cpp
    src/core/emailcomposerbridge.cpp
    src/core/authenticator.cpp
    src/core/gmailauthenticator.cpp
    src/core/outlookauthenticator.cpp
    src/core/imapauthenticator.cpp
    src/core/synchronizerprovider.cpp
    src/core/accountsetupdialoglauncher.cpp
    src/core/oauthcallbackserver.cpp
    src/ui/mainmainwindow.cpp
    src/ui/mainmainwindow.h
    src/ui/newmessagedialog.cpp
    src/ui/newmessagedialog.h
    src/ui/accountsetupdialog.cpp
    src/ui/accountsetupdialog.h
    src/ui/models/FolderListModel.cpp
    src/ui/models/EmailListModel.cpp
    src/ui/readerview.cpp
    src/ui/readerview.h
    src/ui/maillistview.cpp
    src/ui/maillistview.h
    src/ui/composeview.cpp
    src/ui/composeview.h
    src/ui/settingsview.cpp
    src/ui/settingsview.h
    src/ui/contactsview.cpp
    src/ui/contactsview.h
    src/ui/calendarview.cpp
    src/ui/calendarview.h
    src/ui/connectionwizard.cpp
    src/ui/connectionwizard.h
    src/syncscheduler.cpp
)

# Executable
add_executable(wino-mail-qt ${SRC_FILES})

# Link Qt
target_link_libraries(wino-mail-qt PRIVATE Qt6::Core Qt6::Gui Qt6::Widgets Qt6::Network Qt6::Sql Qt6::Concurrent)
