//
//  AboutUsController.swift

//
//  Created by Leon on 2025/9/30.
//

import UIKit

class AboutUsController: CLBaseViewController {
    var scrollContainer: LTScrollContainer!
    var titleView: TitleView!

    var headIcon: AutoRatioImageView!
    var content1Label: LineSpaceLabel!

    override func viewDidLoad() {
        super.viewDidLoad()

        setupViews()
    }

    private func setupViews() {
        let title = "About Us"

        navigationView.alpha0Title = title

        scrollContainer = {
            let v = LTScrollContainer()
            v.stack.spacing = 16
            v.scrollView.delegate = self
            view.addSubview(v)
            v.snp.makeConstraints { make in
                make.top.equalTo(navigationView.snp.bottom)
                make.leading.trailing.bottom.equalToSuperview()
            }
            return v
        }()

        titleView = {
            let v = TitleView()
            v.title = title
            scrollContainer.stack.addArrangedSubview(v)
            v.snp.makeConstraints { make in
                make.leading.trailing.equalToSuperview()
            }
            return v
        }()

        headIcon = {
            let v = AutoRatioImageView()
            v.setImage(UIImage(named: "about_us_head_logo"))
            scrollContainer.stack.addArrangedSubview(v)
            v.snp.makeConstraints { make in
                make.leading.equalToSuperview().offset(CGFloat.lrs)
                make.trailing.equalToSuperview().offset(-CGFloat.lrs)
            }
            return v
        }()
        scrollContainer.stack.setCustomSpacing(24, after: headIcon)

        content1Label = {
            let v = LineSpaceLabel()
            let typo = CLSystemToken.typography(token: .tbm)
            v.config(typo)
            scrollContainer.stack.addArrangedSubview(v)
            v.snp.makeConstraints { make in
                make.leading.equalToSuperview().offset(CGFloat.lrs)
                make.trailing.equalToSuperview().offset(-CGFloat.lrs)
            }
            return v
        }()

        let content = "Grow your love story with CrushLevel AI—From ‘Hi’ to ‘I Do', sparked by every chat\n\nAt CrushLevel AI, every chat writes a new verse in your love epic—From that tentative \"Hi\" to the trembling \"I do\",find a home for the flirts you never sent,the responses you longed for,and the risky emotional gambles you feared to take.\n\nContact Us: support@crushlevel.ai"
        content1Label.text = content
    }
}

extension AboutUsController: UIScrollViewDelegate {
    func scrollViewDidScroll(_ scrollView: UIScrollView) {
        NaviAlphaHandle.changeNaviTitleAlpha(scrollView: scrollView, titleLabel: navigationView.titleLabel)
    }
}
