package com.davos.assessment.project;

import jakarta.persistence.*;
import java.time.Instant;

@Entity
@Table(name = "homepage_appointments")
public class HomepageAppointment {
  @Id
  @GeneratedValue(strategy = GenerationType.IDENTITY)
  private Long id;

  @Column(nullable = false)
  private String name;

  @Column(nullable = false)
  private String organization;

  @Column(nullable = false)
  private String phone;

  @Column(nullable = false)
  private String wechat;

  @Column(nullable = false)
  private String city;

  @Column(name = "source_path", nullable = false)
  private String sourcePath = "/";

  @Column(name = "created_at", nullable = false)
  private Instant createdAt = Instant.now();

  public Long getId() { return id; }
  public String getName() { return name; }
  public void setName(String name) { this.name = name; }
  public String getOrganization() { return organization; }
  public void setOrganization(String organization) { this.organization = organization; }
  public String getPhone() { return phone; }
  public void setPhone(String phone) { this.phone = phone; }
  public String getWechat() { return wechat; }
  public void setWechat(String wechat) { this.wechat = wechat; }
  public String getCity() { return city; }
  public void setCity(String city) { this.city = city; }
  public String getSourcePath() { return sourcePath; }
  public void setSourcePath(String sourcePath) { this.sourcePath = sourcePath == null || sourcePath.isBlank() ? "/" : sourcePath; }
  public Instant getCreatedAt() { return createdAt; }
  public void setCreatedAt(Instant createdAt) { this.createdAt = createdAt; }
}
