package com.dbnt.kcscopensearch.opensearch.docSearch.model;

import com.dbnt.kcscopensearch.kcsc.docView.model.DocIndexView;
import jakarta.persistence.Id;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
import org.springframework.data.elasticsearch.annotations.Document;
import org.springframework.data.elasticsearch.annotations.Field;
import org.springframework.data.elasticsearch.annotations.FieldType;

@Getter
@Setter
@NoArgsConstructor
@Document(indexName = "doc_index")
public class DocIndex {
  @Id
  private Integer id;

  @Field(type = FieldType.Text, name = "kcsc_cd")
  private String kcscCd;
  @Field(type = FieldType.Text, name = "doc_nm")
  private String docNm;
  @Field(type = FieldType.Text, name = "doc_yr")
  private String docYr;
  @Field(type = FieldType.Text, name = "group_title")
  private String groupTitle;

  public DocIndex(DocIndexView view){
    this.id = view.getIndexId();
    this.kcscCd = view.getKcscCd();
    this.docNm = view.getDocNm();
    this.docYr = view.getDocYr();
    this.groupTitle = view.getGroupTitle();
  }
}
