//
//  ContentView.swift
//  SIIMpaPrinterSample
//

import SwiftUI

struct ContentView: View {
    @StateObject var printerViewModel: PrinterViewModel = PrinterViewModel()
    var body: some View {
        ZStack {
                TabView {
                    FirstView(printerViewModel: printerViewModel)
                        .tag(1)
                        .tabItem {
                            Image(systemName: "circle.fill")
                            Text("API")
                        }
                    SecondView(printerViewModel: printerViewModel)
                        .tag(2)
                        .tabItem {
                            Image(systemName: "circle.fill")
                            Text("Settings")
                        }
                }
            .alert(printerViewModel.alertStr, isPresented: $printerViewModel.isShowAlert) {
                Button("OK") {
                    printerViewModel.setAlert("")
                }
            }
        if printerViewModel.isShowIndicator == true {
                LoadingView()
            }
        }
    }
}

#Preview {
    ContentView()
}
