package com.huimv.employment.service.order.dto;

import com.fasterxml.jackson.annotation.JsonProperty;
import io.swagger.v3.oas.annotations.media.Schema;

import java.math.BigDecimal;
import java.time.LocalDate;
import java.util.ArrayList;
import java.util.List;

/**
 * 任务发布详情：供任务发布页回显工种摘要与工作时间。
 */
@Schema(description = "任务发布详情")
public class TaskPublishDetailResponse {

    @JsonProperty("draft_id")
    private Long draftId;

    @JsonProperty("order_id")
    private Long orderId;

    @JsonProperty("order_no")
    private String orderNo;

    @Schema(description = "订单标题")
    private String title;

    @JsonProperty("current_step_code")
    private String currentStepCode;

    @JsonProperty("display_step_code")
    private String displayStepCode;

    @JsonProperty("planned_count")
    @Schema(description = "计划用工人数（各工种合计）")
    private Integer plannedCount;

    @JsonProperty("registered_count")
    @Schema(description = "已完成登记人数（reg_status=completed）")
    private Integer registeredCount;

    @JsonProperty("dates_complete")
    @Schema(description = "全部工种是否已填写起止日")
    private Boolean datesComplete;

    @JsonProperty("task_published")
    @Schema(description = "是否已进入任务发布或后续步骤")
    private Boolean taskPublished;

    @JsonProperty("work_items")
    @Schema(description = "用工明细（工种卡片 + 工作时间）")
    private List<WorkItemDetail> workItems = new ArrayList<>();

    private String message;

    public Long getDraftId() {
        return draftId;
    }

    public void setDraftId(Long draftId) {
        this.draftId = draftId;
    }

    public Long getOrderId() {
        return orderId;
    }

    public void setOrderId(Long orderId) {
        this.orderId = orderId;
    }

    public String getOrderNo() {
        return orderNo;
    }

    public void setOrderNo(String orderNo) {
        this.orderNo = orderNo;
    }

    public String getTitle() {
        return title;
    }

    public void setTitle(String title) {
        this.title = title;
    }

    public String getCurrentStepCode() {
        return currentStepCode;
    }

    public void setCurrentStepCode(String currentStepCode) {
        this.currentStepCode = currentStepCode;
    }

    public String getDisplayStepCode() {
        return displayStepCode;
    }

    public void setDisplayStepCode(String displayStepCode) {
        this.displayStepCode = displayStepCode;
    }

    public Integer getPlannedCount() {
        return plannedCount;
    }

    public void setPlannedCount(Integer plannedCount) {
        this.plannedCount = plannedCount;
    }

    public Integer getRegisteredCount() {
        return registeredCount;
    }

    public void setRegisteredCount(Integer registeredCount) {
        this.registeredCount = registeredCount;
    }

    public Boolean getDatesComplete() {
        return datesComplete;
    }

    public void setDatesComplete(Boolean datesComplete) {
        this.datesComplete = datesComplete;
    }

    public Boolean getTaskPublished() {
        return taskPublished;
    }

    public void setTaskPublished(Boolean taskPublished) {
        this.taskPublished = taskPublished;
    }

    public List<WorkItemDetail> getWorkItems() {
        return workItems;
    }

    public void setWorkItems(List<WorkItemDetail> workItems) {
        this.workItems = workItems != null ? workItems : new ArrayList<>();
    }

    public String getMessage() {
        return message;
    }

    public void setMessage(String message) {
        this.message = message;
    }

    @Schema(description = "任务发布用工明细项")
    public static class WorkItemDetail {

        private Long id;

        @JsonProperty("group_no")
        private String groupNo;

        @JsonProperty("sort_order")
        private Integer sortOrder;

        @JsonProperty("job_type")
        @Schema(description = "岗位类型/工种")
        private String jobType;

        @JsonProperty("worker_count")
        @Schema(description = "用工人数")
        private Integer workerCount;

        @JsonProperty("work_location")
        @Schema(description = "工作地点")
        private String workLocation;

        @JsonProperty("work_days")
        @Schema(description = "工作天数（展示可用作工期）")
        private BigDecimal workDays;

        @JsonProperty("settlement_cycle")
        private String settlementCycle;

        @JsonProperty("unit_amount")
        private BigDecimal unitAmount;

        @JsonProperty("total_amount")
        private BigDecimal totalAmount;

        @JsonProperty("work_content")
        private String workContent;

        @JsonProperty("work_start_date")
        @Schema(description = "计划开始日期；未填则为 null")
        private LocalDate workStartDate;

        @JsonProperty("work_end_date")
        @Schema(description = "计划结束日期；未填则为 null")
        private LocalDate workEndDate;

        public Long getId() {
            return id;
        }

        public void setId(Long id) {
            this.id = id;
        }

        public String getGroupNo() {
            return groupNo;
        }

        public void setGroupNo(String groupNo) {
            this.groupNo = groupNo;
        }

        public Integer getSortOrder() {
            return sortOrder;
        }

        public void setSortOrder(Integer sortOrder) {
            this.sortOrder = sortOrder;
        }

        public String getJobType() {
            return jobType;
        }

        public void setJobType(String jobType) {
            this.jobType = jobType;
        }

        public Integer getWorkerCount() {
            return workerCount;
        }

        public void setWorkerCount(Integer workerCount) {
            this.workerCount = workerCount;
        }

        public String getWorkLocation() {
            return workLocation;
        }

        public void setWorkLocation(String workLocation) {
            this.workLocation = workLocation;
        }

        public BigDecimal getWorkDays() {
            return workDays;
        }

        public void setWorkDays(BigDecimal workDays) {
            this.workDays = workDays;
        }

        public String getSettlementCycle() {
            return settlementCycle;
        }

        public void setSettlementCycle(String settlementCycle) {
            this.settlementCycle = settlementCycle;
        }

        public BigDecimal getUnitAmount() {
            return unitAmount;
        }

        public void setUnitAmount(BigDecimal unitAmount) {
            this.unitAmount = unitAmount;
        }

        public BigDecimal getTotalAmount() {
            return totalAmount;
        }

        public void setTotalAmount(BigDecimal totalAmount) {
            this.totalAmount = totalAmount;
        }

        public String getWorkContent() {
            return workContent;
        }

        public void setWorkContent(String workContent) {
            this.workContent = workContent;
        }

        public LocalDate getWorkStartDate() {
            return workStartDate;
        }

        public void setWorkStartDate(LocalDate workStartDate) {
            this.workStartDate = workStartDate;
        }

        public LocalDate getWorkEndDate() {
            return workEndDate;
        }

        public void setWorkEndDate(LocalDate workEndDate) {
            this.workEndDate = workEndDate;
        }
    }
}
