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

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

import javax.validation.Valid;
import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.NotNull;
import java.util.ArrayList;
import java.util.List;

/**
 * 用工邀请：添加第三方平台工人。
 */
@Schema(description = "添加第三方平台工人请求")
public class ThirdPartyWorkersAddRequest {

    @NotNull(message = "batch_id 不能为空")
    @JsonProperty("batch_id")
    @JsonAlias({"batchId"})
    @Schema(description = "登记批次 ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "23")
    private Long batchId;

    @NotEmpty(message = "workers 不能为空")
    @Valid
    @Schema(description = "第三方工人列表", requiredMode = Schema.RequiredMode.REQUIRED)
    private List<ThirdPartyWorkerAddItem> workers = new ArrayList<>();

    public Long getBatchId() {
        return batchId;
    }

    public void setBatchId(Long batchId) {
        this.batchId = batchId;
    }

    public List<ThirdPartyWorkerAddItem> getWorkers() {
        return workers;
    }

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