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

import com.fasterxml.jackson.annotation.JsonProperty;
import com.huimv.employment.service.settlement.dto.SettlementSummaryResponse;
import io.swagger.v3.oas.annotations.media.Schema;

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

@Schema(description = "任务发布响应")
public class TaskPublishResponse {

    @JsonProperty("draft_id")
    private Long draftId;

    @JsonProperty("order_id")
    private Long orderId;

    @JsonProperty("order_no")
    private String orderNo;

    /** 订单步骤码（发布后为 task_publish；生成结算后为 settlement_pending） */
    @JsonProperty("current_step_code")
    private String currentStepCode;

    /** 产品展示码：task_publish / settlement */
    @JsonProperty("display_step_code")
    private String displayStepCode;

    @JsonProperty("work_items")
    private List<WorkItemBrief> workItems = new ArrayList<>();

    @JsonProperty("settlement")
    private SettlementSummaryResponse settlement;

    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 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 List<WorkItemBrief> getWorkItems() {
        return workItems;
    }

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

    public SettlementSummaryResponse getSettlement() {
        return settlement;
    }

    public void setSettlement(SettlementSummaryResponse settlement) {
        this.settlement = settlement;
    }

    public String getMessage() {
        return message;
    }

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

    @Schema(description = "已更新的用工明细摘要")
    public static class WorkItemBrief {

        private Long id;

        @JsonProperty("group_no")
        private String groupNo;

        @JsonProperty("job_type")
        private String jobType;

        @JsonProperty("work_start_date")
        private LocalDate workStartDate;

        @JsonProperty("work_end_date")
        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 String getJobType() {
            return jobType;
        }

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

        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;
        }
    }
}
