package dev.rheinsw.contactService.model;

import jakarta.persistence.Column;
import jakarta.persistence.Entity;
import jakarta.persistence.GeneratedValue;
import jakarta.persistence.GenerationType;
import jakarta.persistence.Id;
import jakarta.persistence.Table;
import jakarta.validation.constraints.Email;
import jakarta.validation.constraints.Size;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.time.LocalDateTime;

/**
 * @author Thatsaphorn Atchariyaphap
 * @since 22.04.25
 */
@Entity
@Data
@NoArgsConstructor
@Table(name = "contact_requests")
public class ContactRequest {

    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    private Long id;

    @Size(max = 100)
    private String name;

    @Size(max = 100)
    @Email
    private String email;

    @Size(max = 1000)
    @Column(length = 1000)
    private String message;

    @Size(max = 100)
    private String company;

    @Size(max = 20)
    private String phone;

    @Size(max = 100)
    private String website;

    @Size(max = 1024)
    @Column(name = "captcha_token", length = 1024)
    private String captchaToken;

    private LocalDateTime submittedAt;

    public ContactRequest setName(String name) {
        this.name = name;
        return this;
    }

    public ContactRequest setEmail(String email) {
        this.email = email;
        return this;
    }

    public ContactRequest setMessage(String message) {
        this.message = message;
        return this;
    }

    public ContactRequest setCompany(String company) {
        this.company = company;
        return this;
    }

    public ContactRequest setPhone(String phone) {
        this.phone = phone;
        return this;
    }

    public ContactRequest setWebsite(String website) {
        this.website = website;
        return this;
    }

    public ContactRequest setCaptchaToken(String captchaToken) {
        this.captchaToken = captchaToken;
        return this;
    }

    public ContactRequest setSubmittedAt(LocalDateTime submittedAt) {
        this.submittedAt = submittedAt;
        return this;
    }
}
