package at.procon.dip.domain.time.entity.leitstand;

import at.procon.dip.architecture.SchemaNames;
import at.procon.dip.domain.time.entity.TimeEntry;
import jakarta.persistence.Column;
import jakarta.persistence.Entity;
import jakarta.persistence.FetchType;
import jakarta.persistence.Index;
import jakarta.persistence.JoinColumn;
import jakarta.persistence.OneToOne;
import jakarta.persistence.Table;
import java.math.BigDecimal;
import java.time.OffsetDateTime;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;

@Entity
@Table(schema = SchemaNames.TIME, name = "ls_time_recording", indexes = {
        @Index(name = "idx_ls_time_recording_upd", columnList = "upd"),
        @Index(name = "idx_ls_time_recording_person_dbk", columnList = "person_dbk"),
        @Index(name = "idx_ls_time_recording_activity_type_id", columnList = "activity_type_id"),
        @Index(name = "idx_ls_time_recording_from", columnList = "recorded_from"),
        @Index(name = "idx_ls_time_recording_to", columnList = "recorded_to")
})
@Getter @Setter @NoArgsConstructor
public class LeitstandTimeRecording extends AbstractLeitstandDbkEntity {
    @OneToOne(fetch = FetchType.LAZY) @JoinColumn(name = "time_entry_id", unique = true) private TimeEntry timeEntry;
    @Column(name = "person_dbk", length = 24) private String personDbk;
    @Column(name = "lfdnr") private Integer lfdnr;
    @Column(name = "record_type", length = 32) private String recordType;
    @Column(name = "mcl_id", columnDefinition = "TEXT") private String mclId;
    @Column(name = "mcl_desc", columnDefinition = "TEXT") private String mclDesc;
    @Column(name = "recorded_from") private OffsetDateTime recordedFrom;
    @Column(name = "recorded_to") private OffsetDateTime recordedTo;
    @Column(name = "effort", precision = 10, scale = 3) private BigDecimal effort;
    @Column(name = "remark", columnDefinition = "TEXT") private String remark;
    @Column(name = "url", length = 1000) private String url;
    @Column(name = "activity_type_id") private Integer activityTypeId;
}
