//
//  ReportVC.swift
//  MahaSombathLottoPro
//
//  Created by Visoth Phon on 2/1/21.
//

import UIKit

class ReportVC: UIViewController, UITableViewDataSource, UITableViewDelegate  {

    @IBOutlet weak var vcBetResult: UIView!
    @IBOutlet weak var vcWinResult: UIView!
    @IBOutlet weak var vcReportResult: UIView!
    
    @IBOutlet weak var tbResult: UITableView!
    override func viewWillAppear(_ animated: Bool) {
        super.viewWillAppear(animated)
        setNeedsStatusBarAppearanceUpdate()
    }
    
    override var preferredStatusBarStyle: UIStatusBarStyle {
        .lightContent
    }
    
    override func viewDidLoad() {
        super.viewDidLoad()
        Utility.roundCornerView(view: vcBetResult, borderColor: UIColor.white, borderSize: 10.0)
        Utility.roundCornerView(view: vcWinResult, borderColor: UIColor.white, borderSize: 10.0)
        Utility.roundCornerView(view: vcReportResult, borderColor: UIColor.white, borderSize: 10.0)
    }
    
    @IBAction func actionBtnWin_WinVC(_ sender: Any) {
        self.showView(isHiddenWinView: false, isHiddenBetView: true, isHiddenReportView: true)
    }
    @IBAction func actionBtnWin_ResultVC(_ sender: Any) {
        self.showView(isHiddenWinView: false, isHiddenBetView: true, isHiddenReportView: true)
    }
    @IBAction func actionBtnWin_ReportVC(_ sender: Any) {
        self.showView(isHiddenWinView: false, isHiddenBetView: true, isHiddenReportView: true)
    }
    
    
    @IBAction func actionBtnBetView_WinVC(_ sender: Any) {
        self.showView(isHiddenWinView: true, isHiddenBetView: false, isHiddenReportView: true)
    }
    @IBAction func actionBtnBet_ResultVC(_ sender: Any) {
        self.showView(isHiddenWinView: true, isHiddenBetView: false, isHiddenReportView: true)
    }
    @IBAction func actionBtnResult_ReportVC(_ sender: Any) {
        self.showView(isHiddenWinView: true, isHiddenBetView: false, isHiddenReportView: true)
    }
    
    
    @IBAction func actionBtnReport_WinVC(_ sender: Any) {
        self.showView(isHiddenWinView: true, isHiddenBetView: true, isHiddenReportView: false)
    }
    @IBAction func actionBtnReport_ResultVC(_ sender: Any) {
        self.showView(isHiddenWinView: true, isHiddenBetView: true, isHiddenReportView: false)
    }
    @IBAction func actionBtnReport_ReportVC(_ sender: Any) {
        self.showView(isHiddenWinView: true, isHiddenBetView: true, isHiddenReportView: false)
    }
    
    
    @IBAction func actionCloseView(_ sender: Any) {
        self.dismiss(animated: true, completion: nil)
    }
    
    func showView(isHiddenWinView: Bool,
                  isHiddenBetView: Bool,
                  isHiddenReportView: Bool) {
        self.vcWinResult.isHidden = isHiddenWinView
        self.vcBetResult.isHidden = isHiddenBetView
        self.vcReportResult.isHidden = isHiddenReportView

    }
    
    func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
        let cell        = tableView.dequeueReusableCell(withIdentifier: "WinResultCell", for: indexPath) as! WinResultCell
        return cell
    }
    
    func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
        return 5
    }
    
    func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat {
        return 40;
    }
    func tableView(_ tableView: UITableView, heightForHeaderInSection section: Int) -> CGFloat {
        return 0
    }
    
    func tableView(_ tableView: UITableView, viewForHeaderInSection section: Int) -> UIView? {
        return nil;
    }

}
