//
//  YHLoginPrivacyView.swift
//  galaxy
//
//  Created by EDY on 2023/12/26.
//

import UIKit

class YHLoginPrivacyView: UIView {

    var agreeButton: UIButton!
    var messageLabel: UILabel!
    var serviceButton: UIButton!
    var andLabel: UILabel!
    var privacyButton: UIButton!
    
    override init(frame: CGRect) {
        super.init(frame: frame)
        setView()
    }
    
    required init?(coder: NSCoder) {
        fatalError("init(coder:) has not been implemented")
    }
    
    func setView() {
        agreeButton = {
            let button = UIButton(type: .custom)
            button.setBackgroundImage(UIImage(named: "login_privacy_disagree"), for: .normal)
            button.setBackgroundImage(UIImage(named: "login_privacy_agree"), for: .selected)
            return button
        }()
        addSubview(agreeButton)
        agreeButton.snp.makeConstraints { make in
            make.centerY.equalToSuperview()
            make.left.equalToSuperview()
            make.height.equalTo(12)
            make.width.equalTo(12)
        }
        
        messageLabel = {
            let label = UILabel()
            label.text = "我已阅读并同意"
            label.font = kFont(size: 12)
            label.textColor = UIColor(hex:0xffffff)
            label.textAlignment = .left
            return label
        }()
        addSubview(messageLabel)
        messageLabel.snp.makeConstraints { make in
            make.left.equalTo(agreeButton.snp.right).offset(10)
            make.centerY.equalToSuperview()
            make.height.equalTo(20)
        }
        
        serviceButton = {
            let button = UIButton(type: .custom)
            button.titleLabel?.font = kBoldFont(size: 12)
            button.contentHorizontalAlignment = .center
            button.setTitle("《银河服务条款》", for: .normal)
            return button
        }()
        addSubview(serviceButton)
        serviceButton.snp.makeConstraints { make in
            make.left.equalTo(messageLabel.snp.right).offset(1)
            make.centerY.equalToSuperview()
            make.height.equalTo(20)
            make.width.equalTo(96)
        }
        andLabel = {
            let label = UILabel()
            label.text = "和"
            label.font = kFont(size: 12)
            label.textColor = UIColor(hex:0xffffff)
            label.textAlignment = .left
            return label
        }()
        addSubview(andLabel)
        andLabel.snp.makeConstraints { make in
            make.left.equalTo(serviceButton.snp.right).offset(1)
            make.centerY.equalToSuperview()
            make.height.equalTo(20)
        }
        privacyButton = {
            let button = UIButton(type: .custom)
            button.titleLabel?.font = kBoldFont(size: 12)
            button.contentHorizontalAlignment = .center
            button.setTitle("《银河隐私政策》", for: .normal)
            return button
        }()
        addSubview(privacyButton)
        privacyButton.snp.makeConstraints { make in
            make.left.equalTo(andLabel.snp.right).offset(1)
            make.centerY.equalToSuperview()
            make.height.equalTo(20)
            make.width.equalTo(96)
        }
    }
}
