/*
 * Copyright (C) 2026 SHX VPN
 *
 * This program is free software; you can redistribute it and/or modify it
 * under the terms of the GNU General Public License as published by the
 * Free Software Foundation; either version 2 of the License, or (at your
 * option) any later version.
 */

package org.strongswan.android.ui

import android.os.Bundle
import androidx.activity.compose.setContent
import androidx.activity.enableEdgeToEdge
import androidx.appcompat.app.AppCompatActivity
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.padding
import androidx.compose.ui.Modifier
import androidx.compose.ui.res.stringResource
import org.strongswan.android.R
import org.strongswan.android.data.VpnProfileSource
import org.strongswan.android.ui.compose.SecondaryScaffold
import org.strongswan.android.ui.compose.SettingsScreen
import org.strongswan.android.ui.compose.theme.ShxTheme

class SettingsActivity : AppCompatActivity()
{
	override fun onCreate(savedInstanceState: Bundle?)
	{
		super.onCreate(savedInstanceState)
		enableEdgeToEdge()
		val source = VpnProfileSource(this).open()
		val profiles = source.allVpnProfiles
		source.close()
		setContent {
			ShxTheme {
				SecondaryScaffold(title = stringResource(R.string.pref_title), onBack = { finish() }) { padding ->
					Box(Modifier.padding(padding)) {
						SettingsScreen(profiles = profiles, showTitle = false)
					}
				}
			}
		}
	}
}
