//
//  FS_SettingVC.swift
//  Funny_sounds
//
//  Created by 忆海16 on 2024/8/14.
//

import UIKit
import SnapKit

class FS_SettingVC: RootVC {

    override func viewDidLoad() {
        super.viewDidLoad()
    
        setUI()
    }
    
    
    override func viewWillAppear(_ animated: Bool) {
        super.viewWillAppear(animated)
        self.navigationController?.navigationBar.isHidden = true
    }
    
//    MARK: - 设置UI
    
    func setUI(){
        
        lazy var bgImageV:UIImageView = {
            let bgImageV = UIImageView()
            bgImageV.image = UIImage(named: "settingBg")
            bgImageV.contentMode = .scaleAspectFill
            
            return bgImageV
        }()
        
        
        lazy var titleImageV:UIImageView = {
            let titleImageV = UIImageView()
            titleImageV.image = UIImage(named: "settingTitle")
            titleImageV.contentMode = .scaleAspectFit
            
            return titleImageV
        }()
        
        
        lazy var privacyBtn:UIButton = {
            let privacyBtn = UIButton()
            privacyBtn.setBackgroundImage(UIImage(named: "Privacy"), for: .normal)
            privacyBtn.addTarget(self, action: #selector(privacyTouch), for: .touchUpInside)
            privacyBtn.imageView?.contentMode = .scaleToFill
            
            return privacyBtn
        }()
        
        lazy var agreementBtn:UIButton = {
            let agreementBtn = UIButton()
            agreementBtn.setBackgroundImage(UIImage(named: "Agreement"), for: .normal)
            agreementBtn.addTarget(self, action: #selector(agreementTouch), for: .touchUpInside)
            agreementBtn.imageView?.contentMode = .scaleToFill
            return agreementBtn
        }()
        
        
        lazy var shareBtn:UIButton = {
            let shareBtn = UIButton()
            shareBtn.setBackgroundImage(UIImage(named: "Share"), for: .normal)
            shareBtn.addTarget(self, action: #selector(hareTouch), for: .touchUpInside)
            shareBtn.imageView?.contentMode = .scaleToFill
            return shareBtn
        }()
        
        self.view.addSubview(bgImageV)
        self.view.addSubview(titleImageV)
        self.view.addSubview(privacyBtn)
        self.view.addSubview(agreementBtn)
        self.view.addSubview(shareBtn)
        
        bgImageV.snp.makeConstraints { make in
            make.width.equalTo(self.view)
            make.height.equalTo(self.view)
        }
        
        
        titleImageV.snp.makeConstraints { make in
            make.top.equalTo(self.view.safeAreaLayoutGuide).offset(15)
            make.height.equalTo(37.5)
            make.width.equalTo(self.view)
        }
        
        privacyBtn.snp.makeConstraints { make in
            make.top.equalTo(titleImageV.snp.bottom).offset(50)
            make.height.equalTo(70)
            make.width.equalTo(self.view.bounds.width - 92)
            make.centerX.equalToSuperview()
        }
        
        agreementBtn.snp.makeConstraints { make in
            make.top.equalTo(privacyBtn.snp.bottom).offset(32)
            make.height.equalTo(70)
            make.width.equalTo(self.view.bounds.width - 92)
            make.centerX.equalToSuperview()
        }
        shareBtn.snp.makeConstraints { make in
            make.top.equalTo(agreementBtn.snp.bottom).offset(32)
            make.height.equalTo(70)
            make.width.equalTo(self.view.bounds.width - 92)
            make.centerX.equalToSuperview()
        }
        
        
    }
    

    @objc func  privacyTouch(){
        let vc = FS_PrivacyVC()
        vc.type = 1
        self.present(vc, animated: true)
        
    }
    
    @objc func agreementTouch(){
        
        let vc = FS_PrivacyVC()
        vc.type = 0
        self.present(vc, animated: true)
        
    }
    
    
    @objc func hareTouch(){
        let vc = testRecording()
        
        self.navigationController?.pushViewController(vc, animated: true)
        
    }
    
}
