<commit_before>//
//  ItemStyle.swift
//  SwiftyEcharts
//
//  Created by <NAME> on 03/01/2017.
//  Copyright © 2017 com.pluto-y. All rights reserved.
//

public protocol ItemStyleContent: Colorful, Borderable, Shadowable, Opacitable {
    var borderType: LineType? { get set }
}

public final class CommonItemStyleContent: ItemStyleContent {
    
    public var color: Color?
    public var borderColor: Color?
    public var borderWidth: Float?
    public var borderType: LineType?
    public var shadowBlur: Float?
    public var shadowColor: Color?
    public var shadowOffsetX: Float?
    public var shadowOffsetY: Float?
    public var opacity: Float? {
        didSet {
            validateOpacity()
        }
    }
    /// 目前只针对 `BarSerie`
    public var barBorderRadius: Float?
    
    public init() { }
}

extension CommonItemStyleContent: Enumable {
    public enum Enums {
        case color(Color), borderColor(Color), borderWidth(Float), borderType(LineType), shadowBlur(Float), shadowColor(Color), shadowOffsetX(Float), shadowOffsetY(Float), opacity(Float), barBorderRadius(Float)
    }
    
    public typealias ContentEnum = Enums
    
    public convenience init(_ elements: Enums...) {
        self.init()
        for ele in elements {
            switch ele {
            case let .color(color):
                self.color = color
            case let .borderColor(color):
                self.borderColor = color
            case let .borderWidth(width):
                self.borderWidth = width
            case let .borderType(borderType):
                self.borderType = borderType
            case let .shadowBlur(blur):
                self.shadowBlur = blur
            case let .shadowColor(color):
                self.shadowColor = color
            case let .shadowOffsetX(x):
                self.shadowOffsetX = x
            case let .shadowOffsetY(y):
                self.shadowOffsetY = y
            case let .opacity(opacity):
                self.opacity = opacity
            case let .barBorderRadius(barBorderRadius):
                self.barBorderRadius = barBorderRadius
            }
        }
    }
}

extension CommonItemStyleContent: Mappable {
    public func mapping(map: Mapper) {
        map["color"] = color
        map["borderColor"] = borderColor
        map["borderWidth"] = borderWidth
        map["borderType"] = borderType
        map["shadowBlur"] = shadowBlur
        map["shadowColor"] = shadowColor
        map["shadowOffsetX"] = shadowOffsetX
        map["shadowOffsetY"] = shadowOffsetY
        map["opacity"] = opacity
        map["barBorderRadius"] = barBorderRadius
    }
}

public final class ItemStyle: Emphasisable {
    public typealias Style = CommonItemStyleContent
    
    public var normal: Style?
    public var emphasis: Style?
    
    public init() { }
}

public typealias EmphasisItemStyle = ItemStyle

extension ItemStyle: Enumable {
    public enum Enums {
        case normal(Style), emphasis(Style)
    }
    
    public typealias ContentEnum = Enums<commit_msg>feature(model): Add new property for `CommonItemStyleContent`, which named 'areaColor'<commit_after>//
//  ItemStyle.swift
//  SwiftyEcharts
//
//  Created by <NAME> on 03/01/2017.
//  Copyright © 2017 com.pluto-y. All rights reserved.
//

public protocol ItemStyleContent: Colorful, Borderable, Shadowable, Opacitable {
    var borderType: LineType? { get set }
}

public final class CommonItemStyleContent: ItemStyleContent {
    
    public var color: Color?
    public var borderColor: Color?
    public var borderWidth: Float?
    public var borderType: LineType?
    public var shadowBlur: Float?
    public var shadowColor: Color?
    public var shadowOffsetX: Float?
    public var shadowOffsetY: Float?
    public var opacity: Float? {
        didSet {
            validateOpacity()
        }
    }
    /// 目前只针对 `BarSerie`
    public var barBorderRadius: Float?
    public var areaColor: Color?
    
    public init() { }
}

extension CommonItemStyleContent: Enumable {
    public enum Enums {
        case color(Color), borderColor(Color), borderWidth(Float), borderType(LineType), shadowBlur(Float), shadowColor(Color), shadowOffsetX(Float), shadowOffsetY(Float), opacity(Float), barBorderRadius(Float), areaColor(Color)
    }
    
    public typealias ContentEnum = Enums
    
    public convenience init(_ elements: Enums...) {
        self.init()
        for ele in elements {
            switch ele {
            case let .color(color):
                self.color = color
            case let .borderColor(color):
                self.borderColor = color
            case let .borderWidth(width):
                self.borderWidth = width
            case let .borderType(borderType):
                self.borderType = borderType
            case let .shadowBlur(blur):
                self.shadowBlur = blur
            case let .shadowColor(color):
                self.shadowColor = color
            case let .shadowOffsetX(x):
                self.shadowOffsetX = x
            case let .shadowOffsetY(y):
                self.shadowOffsetY = y
            case let .opacity(opacity):
                self.opacity = opacity
            case let .barBorderRadius(barBorderRadius):
                self.barBorderRadius = barBorderRadius
            case let .areaColor(areaColor):
                self.areaColor = areaColor
            }
        }
    }
}

extension CommonItemStyleContent: Mappable {
    public func mapping(map: Mapper) {
        map["color"] = color
        map["borderColor"] = borderColor
        map["borderWidth"] = borderWidth
        map["borderType"] = borderType
        map["shadowBlur"] = shadowBlur
        map["shadowColor"] = shadowColor
        map["shadowOffsetX"] = shadowOffsetX
        map["shadowOffsetY"] = shadowOffsetY
        map["opacity"] = opacity
        map["barBorderRadius"] = barBorderRadius
        map["areaColor"] = areaColor
    }
}

public final class ItemStyle: Emphasisable {
    public typealias Style = CommonItemStyleContent
    
    public var normal: Style?
    public var emphasis: Style?
    
    public init() { }
}

public typealias EmphasisItemStyle = ItemStyle

extension ItemStyle: Enumable {
    public enum Enums {
        case normal(Style), emphasis(Style)
    }
    
    public typealias ContentEnum = Enums
{'fraction_non_alphanumeric': 0.0878463476070529, 'fraction_numerical': 0.003778337531486146, 'mean_word_length': 2.2462953500255494, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2637255', 'n_tokens_mistral': 1735, 'n_tokens_neox': 1685, 'n_words': 467}