package build

import mill._
import mill.scalalib._
import mill.scalalib.Assembly._

object summercms extends ScalaModule {
  def scalaVersion = "3.3.4"

  def mvnDeps = Seq(
    // ZIO Core
    mvn"dev.zio::zio:2.1.14",

    // ZIO HTTP
    mvn"dev.zio::zio-http:3.0.1",

    // ZIO Config
    mvn"dev.zio::zio-config:4.0.2",
    mvn"dev.zio::zio-config-typesafe:4.0.2",
    mvn"dev.zio::zio-config-magnolia:4.0.2",

    // Database - Quill with ZIO
    mvn"io.getquill::quill-jdbc-zio:4.8.5",

    // PostgreSQL JDBC Driver
    mvn"org.postgresql:postgresql:42.7.4",

    // Flyway for migrations
    mvn"org.flywaydb:flyway-core:10.21.0",
    mvn"org.flywaydb:flyway-database-postgresql:10.21.0",

    // Logging
    mvn"org.slf4j:slf4j-simple:2.0.9"
  )

  def scalacOptions = Seq(
    "-deprecation",
    "-feature",
    "-unchecked",
    "-Xfatal-warnings"
  )

  // Assembly configuration for fat JAR
  def assemblyRules = super.assemblyRules ++ Seq(
    // Merge service files
    Rule.Append("META-INF/services/.*"),
    // Exclude signature files
    Rule.Exclude("META-INF/.*\\.SF"),
    Rule.Exclude("META-INF/.*\\.DSA"),
    Rule.Exclude("META-INF/.*\\.RSA")
  )
}
