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

import com.dbnt.kcscopensearch.kcsc.docView.model.DocTitleView;
import jakarta.persistence.*;
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_title")
public class DocTitle {
  @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;

  public DocTitle(DocTitleView view){
    this.id= view.getTitleId();
    this.kcscCd = view.getKcscCd();
    this.docNm = view.getDocNm();
    this.docYr = view.getDocYr();
  }
}
