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

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

import java.util.ArrayList;
import java.util.List;

/**
 * 第三方人力可用工人按工种分组结果（Mock）。
 */
@Schema(description = "第三方人力可用工人按工种分组结果")
public class ThirdPartyWorkerGroupResponse {

    @Schema(description = "查询条件回显")
    private List<ThirdPartyWorkerQueryItem> queries = new ArrayList<>();

    @JsonProperty("total_count")
    @Schema(description = "匹配到的可用工人总数")
    private Integer totalCount;

    @Schema(description = "按工种分类的可用人员分组")
    private List<JobTypeGroup> groups = new ArrayList<>();

    @Schema(description = "数据来源说明", example = "mock")
    private String source;

    private String message;

    public List<ThirdPartyWorkerQueryItem> getQueries() {
        return queries;
    }

    public void setQueries(List<ThirdPartyWorkerQueryItem> queries) {
        this.queries = queries != null ? queries : new ArrayList<>();
    }

    public Integer getTotalCount() {
        return totalCount;
    }

    public void setTotalCount(Integer totalCount) {
        this.totalCount = totalCount;
    }

    public List<JobTypeGroup> getGroups() {
        return groups;
    }

    public void setGroups(List<JobTypeGroup> groups) {
        this.groups = groups != null ? groups : new ArrayList<>();
    }

    public String getSource() {
        return source;
    }

    public void setSource(String source) {
        this.source = source;
    }

    public String getMessage() {
        return message;
    }

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

    @Schema(description = "某一工种下的可用人员")
    public static class JobTypeGroup {

        @JsonProperty("job_type")
        @Schema(description = "工种名称", example = "搬运工")
        private String jobType;

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

        @Schema(description = "可用人员列表（含 mobile / id_card_no 明文）")
        private List<ThirdPartyAvailableWorkerItem> workers = new ArrayList<>();

        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 List<ThirdPartyAvailableWorkerItem> getWorkers() {
            return workers;
        }

        public void setWorkers(List<ThirdPartyAvailableWorkerItem> workers) {
            this.workers = workers != null ? workers : new ArrayList<>();
        }
    }
}
