package ru.nbch.indicsearchservice.dto.request;

import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.NotNull;
import jakarta.validation.constraints.Size;
import java.util.Objects;
import ru.nbch.indicsearchservice.model.enums.DataType;
import ru.nbch.indicsearchservice.model.enums.SearchParameter;

@Schema(description = "Add search job request data transfer object")
public class AddSearchJobRequestDto {
    @Schema(description = "Data type", example = "GUTDF")
    @NotNull
    private DataType dataType;

    @Schema(description = "Search parameter", example = "APPLICATION_NUMBER")
    @NotNull
    private SearchParameter searchParameter;

    @Schema(description = "Search value", example = "1")
    @NotBlank
    private String searchValue;

    @Schema(description = "Member code", example = "AAA000")
    @NotBlank
    @Size(min = 6)
    private String memberCode;

    public AddSearchJobRequestDto() {
    }

    public AddSearchJobRequestDto(DataType dataType, SearchParameter searchParameter, String searchValue, String memberCode) {
        this.dataType = dataType;
        this.searchParameter = searchParameter;
        this.searchValue = searchValue;
        this.memberCode = memberCode;
    }

    public DataType getDataType() {
        return dataType;
    }

    public void setDataType(DataType dataType) {
        this.dataType = dataType;
    }

    public SearchParameter getSearchParameter() {
        return searchParameter;
    }

    public void setSearchParameter(SearchParameter searchParameter) {
        this.searchParameter = searchParameter;
    }

    public String getSearchValue() {
        return searchValue;
    }

    public void setSearchValue(String searchValue) {
        this.searchValue = searchValue;
    }

    public String getMemberCode() {
        return memberCode;
    }

    public void setMemberCode(String memberCode) {
        this.memberCode = memberCode;
    }

    @Override
    public boolean equals(Object o) {
        if (o == null || getClass() != o.getClass()) return false;
        AddSearchJobRequestDto that = (AddSearchJobRequestDto) o;
        return dataType == that.dataType && searchParameter == that.searchParameter && Objects.equals(searchValue, that.searchValue) && Objects.equals(memberCode, that.memberCode);
    }

    @Override
    public int hashCode() {
        return Objects.hash(dataType, searchParameter, searchValue, memberCode);
    }

    @Override
    public String toString() {
        return "AddSearchJobRequestDto{" +
            "dataType=" + dataType +
            ", searchParameter=" + searchParameter +
            ", searchValue='" + searchValue + '\'' +
            ", memberCode='" + memberCode + '\'' +
            '}';
    }
}
