# ==========================================
# Home4j Application Configuration
# ==========================================

# Application Info
quarkus.application.name=home4j
quarkus.application.version=0.1.0

# ==========================================
# HTTP Configuration
# ==========================================
quarkus.http.port=8080
quarkus.http.host=0.0.0.0

# ==========================================
# Database Configuration (H2 - Default)
# ==========================================
quarkus.datasource.db-kind=h2
quarkus.datasource.username=sa
quarkus.datasource.password=
quarkus.datasource.jdbc.url=jdbc:h2:file:./data/home4j;AUTO_SERVER=TRUE

# Hibernate ORM
quarkus.hibernate-orm.database.generation=update
quarkus.hibernate-orm.log.sql=false
quarkus.hibernate-orm.physical-naming-strategy=org.hibernate.boot.model.naming.CamelCaseToUnderscoresNamingStrategy

# ==========================================
# MySQL Configuration (Optional - Uncomment to use)
# ==========================================
# %mysql.quarkus.datasource.db-kind=mysql
# %mysql.quarkus.datasource.username=home4j
# %mysql.quarkus.datasource.password=your_password
# %mysql.quarkus.datasource.jdbc.url=jdbc:mysql://localhost:3306/home4j?useSSL=false&allowPublicKeyRetrieval=true&serverTimezone=UTC

# ==========================================
# Security Configuration (Form-based Auth)
# ==========================================
quarkus.http.auth.form.enabled=true
quarkus.http.auth.form.login-page=/login
quarkus.http.auth.form.error-page=/login?error=true
quarkus.http.auth.form.landing-page=/
quarkus.http.auth.form.post-location=/j_security_check
quarkus.http.auth.form.username-parameter=j_username
quarkus.http.auth.form.password-parameter=j_password
quarkus.http.auth.form.cookie-name=home4j-session
quarkus.http.auth.form.timeout=PT24H
quarkus.http.auth.form.new-cookie-interval=PT1H
quarkus.http.auth.form.http-only-cookie=true
quarkus.http.auth.form.cookie-same-site=lax

# Session Cookie Configuration
quarkus.http.auth.session.encryption-key=home4j-secret-key-change-in-production

# Public resources (no authentication required)
quarkus.http.auth.permission.public.paths=/,/api/search,/login,/login/*,/css/*,/js/*,/images/*,/icons/*,/favicon.ico,/q/*
quarkus.http.auth.permission.public.policy=permit

# Admin resources (require ADMIN role)
quarkus.http.auth.permission.admin.paths=/admin,/admin/*
quarkus.http.auth.permission.admin.policy=authenticated

# Admin API (JSON REST API, require ADMIN role)
quarkus.http.auth.permission.api-admin.paths=/api/admin,/api/admin/*
quarkus.http.auth.permission.api-admin.policy=authenticated

# ==========================================
# Qute Template Configuration
# ==========================================
quarkus.qute.content-types.html=text/html;charset=UTF-8
quarkus.qute.suffixes=html,qute.html

# ==========================================
# Static Resources
# ==========================================
quarkus.http.enable-compression=true

# ==========================================
# Health Check
# ==========================================
quarkus.smallrye-health.root-path=/q/health

# ==========================================
# OpenAPI / Swagger
# ==========================================
quarkus.smallrye-openapi.path=/q/openapi
quarkus.swagger-ui.always-include=true
quarkus.swagger-ui.path=/q/swagger-ui

# ==========================================
# Logging
# ==========================================
quarkus.log.level=INFO
quarkus.log.category."com.home4j".level=DEBUG
quarkus.log.console.format=%d{yyyy-MM-dd HH:mm:ss} %-5p [%c{2.}] (%t) %s%e%n

# ==========================================
# Dev Mode Configuration
# ==========================================
%dev.quarkus.hibernate-orm.database.generation=drop-and-create
%dev.quarkus.hibernate-orm.log.sql=true
%dev.quarkus.log.category."com.home4j".level=DEBUG

# ==========================================
# Production Configuration
# ==========================================
%prod.quarkus.hibernate-orm.database.generation=update
%prod.quarkus.hibernate-orm.log.sql=false
%prod.quarkus.log.level=WARN
%prod.quarkus.log.category."com.home4j".level=INFO
