package de.ph87.isabell_und_timo.picture;

import jakarta.annotation.Nullable;
import jakarta.persistence.Column;
import jakarta.persistence.Entity;
import jakarta.persistence.Id;
import jakarta.persistence.Version;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.NonNull;
import lombok.Setter;
import lombok.ToString;

import java.time.ZonedDateTime;
import java.util.UUID;

@Entity
@Getter
@ToString
@NoArgsConstructor
public class Picture {

  @Id
  private String uuid = UUID.randomUUID().toString();

  @Version
  private long version;

  @NonNull
  @Column(nullable = false)
  private String originalFilename;

  @Column
  @Nullable
  private ZonedDateTime originalDate;

  @Column
  @Nullable
  private long size;

  @Column
  @Nullable
  private int height;

  @Column
  @Nullable
  private int width;

  @Column
  @Nullable
  private String make;

  @Column
  @Nullable
  private String model;

  @NonNull
  private String uploadFilename;

  @NonNull
  @Column(nullable = false)
  private ZonedDateTime uploadDate;

  @NonNull
  @Column(nullable = false)
  private String uploadAddress;

  @Column
  @Nullable
  private String uploadAgent;

  @Setter
  @Column(nullable = false)
  private boolean visible = true;

  public Picture(
    @NonNull final String originalFilename,
    @Nullable final ZonedDateTime originalDate,
    final long size,
    final int width,
    final int height,
    @Nullable final String make,
    @Nullable final String model,
    @NonNull final String uploadFilename,
    @NonNull final ZonedDateTime uploadDate,
    @NonNull final String uploadAddress,
    @Nullable final String uploadAgent
  ) {
    this.originalFilename = originalFilename;
    this.originalDate = originalDate;
    this.size = size;
    this.width = width;
    this.height = height;
    this.make = make;
    this.model = model;
    this.uploadFilename = uploadFilename;
    this.uploadDate = uploadDate;
    this.uploadAddress = uploadAddress;
    this.uploadAgent = uploadAgent;
  }

}
