//
//  VehicleLogoutView.swift
//  OrderScheduling
//
//  Created by 中道 on 2023/9/12.
//

import Foundation
import DDControlsKit_Private
import DDAutoUIKit_Private

open class VehicleLogoutView : DDView{
    private let radiusView : DDView
    private let scrollView : DDScrollView
    private let scrollContentView : DDView
    public let titleLabel : DDLabel
    public let contentLabel : DDLabel
    public let horizontalLine : DDView
    public let verticalLine : DDView
    public let cancelButton : DDButton
    public let sureButton : DDButton
    public override init(frame: CGRect) {
        radiusView = DDView.init()
        scrollView = DDScrollView()
        scrollContentView = DDView.init()
        titleLabel = DDLabel.dd_init(withText: "", font: .mediumFont(auto(17)), textColor: .black.alpha(0.5))
        contentLabel = DDLabel.dd_init(withText: "", font: .mediumFont(auto(14)), textColor: .black.alpha(0.5))
        horizontalLine = DDView()
        verticalLine = DDView()
        cancelButton = DDButton.dd_initCustom()
        sureButton = DDButton.dd_initCustom()
        super.init(frame: frame)
        radiusView.layer.cornerRadius = auto(10)
        radiusView.layer.masksToBounds = true
        addSubview(radiusView)
        radiusView.addSubview(scrollView)
        scrollView.addSubview(scrollContentView)
        titleLabel.textAlignment = .center
        scrollContentView.addSubview(titleLabel)
        contentLabel.numberOfLines = 0
        contentLabel.textAlignment = .center
        contentLabel.text = ""
        scrollContentView.addSubview(contentLabel)
        horizontalLine.backgroundColor = .hex("979797").alpha(0.35)
        radiusView.addSubview(horizontalLine)
        verticalLine.backgroundColor = .hex("979797").alpha(0.35)
        verticalLine.isHidden = true
        radiusView.addSubview(verticalLine)
        cancelButton.setTitle("取消", for: .normal)
        cancelButton.titleLabel?.font = .mediumFont(auto(14))
        cancelButton.backgroundColor = .white
        cancelButton.setTitleColor(.black.alpha(0.3), for: .normal)
        radiusView.addSubview(cancelButton)
        sureButton.setTitle("确定", for: .normal)
        sureButton.setTitleColor(.white, for: .normal)
        sureButton.titleLabel?.font = .mediumFont(auto(14))
        sureButton.backgroundColor = .hex("1C62D9")
        radiusView.addSubview(sureButton)
        
        radiusView.snp.makeConstraints { make in
            make.edges.equalToSuperview()
        }
        
        scrollView.snp.makeConstraints { make in
            make.top.left.right.equalToSuperview()
            make.bottom.equalTo(horizontalLine.snp.top)
        }
        
        scrollContentView.snp.makeConstraints { make in
            make.edges.equalToSuperview()
            make.width.equalToSuperview()
            make.height.greaterThanOrEqualToSuperview()
        }
        
        titleLabel.snp.makeConstraints { make in
            make.left.right.top.equalTo(0)
            make.height.greaterThanOrEqualTo(auto(30))
        }
        
        contentLabel.snp.makeConstraints { make in
            make.left.equalToSuperview().offset(auto(20))
            make.top.equalTo(titleLabel.snp.bottom).offset(0)
            make.right.equalTo(-auto(20))
            make.bottom.equalTo(scrollContentView).offset(-auto(20))
        }
        
        horizontalLine.snp.makeConstraints { make in
            make.bottom.equalToSuperview().offset(-auto(40))
            make.left.right.equalToSuperview()
            make.height.equalTo(1)
        }
        
        verticalLine.snp.makeConstraints { make in
            make.centerX.equalToSuperview()
            make.top.equalTo(horizontalLine.snp.bottom)
            make.bottom.equalToSuperview()
            make.width.equalTo(1)
        }
        
        cancelButton.snp.makeConstraints { make in
            make.left.equalToSuperview()
            make.right.equalTo(verticalLine.snp.left)
            make.top.equalTo(horizontalLine.snp.bottom)
            make.bottom.equalToSuperview()
        }
        
        sureButton.snp.makeConstraints { make in
            make.bottom.equalToSuperview()
            make.right.equalToSuperview()
            make.top.equalTo(horizontalLine.snp.top)
            make.left.equalTo(verticalLine.snp.right)
        }

    }
    
    public required init?(coder: NSCoder) {
        fatalError("init(coder:) has not been implemented")
    }
}
