//
//  UI_Func_Prefix.swift
//  SwiftDataTest
//
//  Created by Sean Kim on 3/27/24.
//

import SwiftUI

enum FontType {
    case Title
    case Content
    case Small
}

enum Icon {
    static let left = Image(systemName: "chevron.left")
    static let right = Image(systemName: "chevron.right")
    static let up = Image(systemName: "chevron.up")
    static let down = Image(systemName: "chevron.down")
    
    static let menu = Image(systemName: "line.3.horizontal")
    static let house = Image(systemName: "house")
    static let magazine = Image(systemName: "magazine")
    static let calendar = Image(systemName: "calendar")
    static let gearshape = Image(systemName: "gearshape")
    
    static let plus = Image(systemName: "plus")
    static let bookmark = Image(systemName: "bookmark")
    static let bookmark_fill = Image(systemName: "bookmark.fill")
    
    static let book = Image(systemName: "book")
    static let book_closed = Image(systemName: "book.closed")
    static let books = Image(systemName: "books.vertical")
    
    static let filter = Image(systemName: "line.3.horizontal.decrease")
    
    static let circle = Image(systemName: "circle")
    static let circle_fill = Image(systemName: "circle.fill")
    static let circle_check = Image(systemName: "checkmark.circle")
    static let smallCircle = Image(systemName: "smallcircle.filled.circle")
    
    static let checkmark = Image(systemName: "checkmark")
    
    
    static let trash = Image(systemName: "trash")
    
    static let xmarkCircle = Image(systemName: "xmark.circle.fill")
    
}



// MARK: - 고유 코드 생성
enum CodeName: String{
    case group = "01"
    case item  = "02"
}

func makeCode(_ name: CodeName) -> String{
    let dateString = Date().convertString("yyyyMMddHHmmssSSS") // 17글자
    return "\(name.rawValue):\(dateString)"
}

func generate8Code() -> String {
    let letters = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
    let digits = "0123456789"
    let allCharacters = letters + digits
    var code: [Character] = []
    
    for _ in 0..<3 {
        if let digit = digits.randomElement() {
            code.append(digit)
        }
    }
    for _ in 0..<5 {
        if let char = allCharacters.randomElement() {
            code.append(char)
        }
    }
    code.shuffle()
    
    return String(code)
}
