import UIKit
import DcCore

class EmptyStateLabel: PaddingTextView {

    override init() {
        super.init()
        backgroundColor = DcColors.systemMessageBackgroundColor
        label.textColor = DcColors.defaultTextColor
        layer.cornerRadius = 10
        label.clipsToBounds = true
        paddingTop = 15
        paddingBottom = 15
        paddingLeading = 15
        paddingTrailing = 15
        translatesAutoresizingMaskIntoConstraints = false
    }

    func addCenteredTo(parentView: UIView) {
        parentView.addSubview(self)
        leadingAnchor.constraint(equalTo: parentView.leadingAnchor, constant: 40).isActive = true
        trailingAnchor.constraint(equalTo: parentView.trailingAnchor, constant: -40).isActive = true
        centerYAnchor.constraint(equalTo: parentView.safeAreaLayoutGuide.centerYAnchor).isActive = true
        centerXAnchor.constraint(equalTo: parentView.safeAreaLayoutGuide.centerXAnchor).isActive = true
    }

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