//
//  EmojiArtModel.swift
//  EmojiArtModel
//
//  Created by Felipe on 04/10/21.
//

import Foundation

struct EmojiArtModel {
    var background: Background
    var emojis = Array<Emoji>()
    
    init() {
        self.background = .blank
    }
    
    var uniqueEmojiId = 0
    
    mutating func addEmoji(_ text: String, at location: (x: Int, y: Int), size: Int ) {
        uniqueEmojiId += 1
        emojis.append(Emoji(text: text, x: location.x, y: location.y, size: size, id: uniqueEmojiId))
    }
    
    
    struct Emoji: Identifiable, Hashable {
        let text: String
        var x: Int // offset from the center
        var y: Int // offset from the center
        var size: Int
        var id: Int
        
        fileprivate init(text: String, x: Int, y: Int, size: Int, id: Int) {
            self.text = text
            self.x = x
            self.y = y
            self.size = size
            self.id = id
        }
    }
    
}
