//
//  PLJobCellView.swift
//  IOS_study
//
//  Created by CC-star on 2025/6/12.
//

import SwiftUI

struct PLJobCellView: View {
   let job: PLJob
   var body: some View {
      VStack(spacing: 8) {
         //第一层
         HStack {
            VStack(alignment: .leading) {
               HStack {
                  Text(job.business)
                     .labelBG2()
                  if job.updatedAt.daysFromNow <= 7 { Text("新到").labelWA() }
                  Text("3人想去")
                     .size13s()
               }
               HStack {
                  Text(job.title).tc().headline().oneLineStyleMiddle()
                  
                  if job.tax == "不报税" {
                     Text(job.tax).accentBorder()
                  } else if job.tax == "报税" {
                     Text(job.tax).redBorder()
                  }
               }
            }
            Spacer()
            Text("\(job.hourlyWage)").accent().headline()
         }
         //第二层
         OverflowGrid(horizontalSpacing: 5) {
            Text(job.needExp).labelBG()
            Text(job.needEdu).labelBG()
            Text(job.needLan).labelBG()
            Text(job.needFrame).labelBG()
            Text("\(job.startHour)-\(job.endHour)").labelBG()
            if job.has2 {
               Text("\(job.startHour2)-\(job.endHour2)").labelBG()
            }
            if job.moveFee { Text("交通费").labelPP() }
            if job.noOverTime { Text("不加班").labelPP() }
            
         }.push(to: .leading)
         
         //第三层
         HStack {
            Text(job.placeName).tc().lineLimit(1)
            Spacer()
            Text("\(job.province)-\(job.city)").accent().semib().oneLineStyleMiddle()
         }.size14()
      }
      .cellPaddingRadius().cellOutPadding()
   }
}

#Preview {
   PLJobCellView(job: PLJob.job)
}
