//
//  PagingView.swift

//
//  Created by Leon on 2025/7/20.
//
import JXPagingView
import JXSegmentedView

extension JXPagingListContainerView: @retroactive JXSegmentedViewListContainer {}

extension JXSegmentedTitleDataSource {
    public func clNormalStyle() {
        isItemSpacingAverageEnabled = false
        // itemWidth = UIScreen.width / 2
        itemSpacing = 32
        titleNormalColor = .c.ctsn
        titleSelectedColor = .c.ctpn
        titleNormalFont = .t.tll
        titleSelectedFont = .t.tll
    }
    
    public func naviTitleStyle(){
        isItemSpacingAverageEnabled = false
        itemSpacing = 32
        titleNormalColor = .c.ctsn
        titleSelectedColor = .c.ctpn
        titleNormalFont = .t.ths
        titleSelectedFont = .t.ths
    }
    
    public func searchListMainStyle(){
        isItemSpacingAverageEnabled = true
        titleNormalColor = .c.ctsn
        titleSelectedColor = .c.ctpn
        titleNormalFont = .t.tll
        titleSelectedFont = .t.tll
    }
}

extension JXSegmentedView{
    /// 主要设置indicator
    public func clNormalStyle() {
        contentEdgeInsetLeft = 24
        contentEdgeInsetRight = 24
        
        let indicator = JXSegmentedIndicatorLineView()
        indicator.indicatorWidth = JXSegmentedViewAutomaticDimension
        indicator.indicatorWidth = 16
        indicator.indicatorHeight = 2
        indicator.indicatorColor = .c.cpn
        indicator.verticalOffset = 4
        indicators = [indicator]
    }
    
    public func naviTitleStyle(){
        contentEdgeInsetLeft = 24
        contentEdgeInsetRight = 24
        
        let indicator = JXSegmentedIndicatorLineView()
        indicator.indicatorWidth = JXSegmentedViewAutomaticDimension
        indicator.indicatorWidth = 20
        indicator.indicatorHeight = 3
        indicator.indicatorColor = .c.cpn
        indicator.verticalOffset = 4
        indicators = [indicator]
    }
    
    public func searchListMainStyle(){
        let indicator = JXSegmentedIndicatorLineView()
        indicator.indicatorWidth = JXSegmentedViewAutomaticDimension
        indicator.indicatorWidth = 20
        indicator.indicatorHeight = 3
        indicator.indicatorColor = .c.cpn
        indicator.verticalOffset = 4
        indicators = [indicator]
    }
}
