//
//  StatusNotFoundView.swift
//  Tusker
//
//  Created by Shadowfacts on 1/17/23.
//  Copyright © 2023 Shadowfacts. All rights reserved.
//

import UIKit

class StatusNotFoundView: UIView {

    override init(frame: CGRect) {
        super.init(frame: frame)
        
        let emoji = UILabel()
        emoji.font = .systemFont(ofSize: 64)
        emoji.text = "🤷"
        
        let title = UILabel()
        title.textColor = .secondaryLabel
        title.font = .preferredFont(forTextStyle: .title1).withTraits(.traitBold)!
        title.adjustsFontForContentSizeCategory = true
        title.text = "Not Found"
        
        let subtitle = UILabel()
        subtitle.textColor = .secondaryLabel
        subtitle.font = .preferredFont(forTextStyle: .body)
        subtitle.adjustsFontForContentSizeCategory = true
        subtitle.text = "The post you are looking for may have been deleted, or may not be visible to you."
        subtitle.numberOfLines = 0
        subtitle.textAlignment = .center
        
        let stack = UIStackView(arrangedSubviews: [
            emoji,
            title,
            subtitle,
        ])
        stack.axis = .vertical
        stack.alignment = .center
        stack.spacing = 8
        stack.isAccessibilityElement = true
        stack.accessibilityLabel = "\(title.text!). \(subtitle.text!)"
        
        stack.translatesAutoresizingMaskIntoConstraints = false
        addSubview(stack)
        NSLayoutConstraint.activate([
            stack.leadingAnchor.constraint(equalTo: leadingAnchor),
            stack.trailingAnchor.constraint(equalTo: trailingAnchor),
            stack.topAnchor.constraint(equalTo: topAnchor),
            stack.bottomAnchor.constraint(equalTo: bottomAnchor),
        ])
    }
    
    required init?(coder: NSCoder) {
        fatalError("init(coder:) has not been implemented")
    }
    

}
