package de.cannamanage.domain.entity;

import de.cannamanage.domain.enums.MemberStatus;
import jakarta.persistence.*;

import java.time.LocalDate;
import java.util.UUID;

@Entity
@Table(name = "members",
    uniqueConstraints = {
        @UniqueConstraint(columnNames = {"email", "tenant_id"}),
        @UniqueConstraint(columnNames = {"membership_number", "tenant_id"})
    }
)
public class Member extends AbstractTenantEntity {

    @Column(name = "club_id", nullable = false)
    private UUID clubId;

    @Column(name = "first_name", nullable = false, length = 100)
    private String firstName;

    @Column(name = "last_name", nullable = false, length = 100)
    private String lastName;

    @Column(name = "email", nullable = false, length = 255)
    private String email;

    @Column(name = "date_of_birth", nullable = false)
    private LocalDate dateOfBirth;

    @Column(name = "membership_date", nullable = false)
    private LocalDate membershipDate;

    @Column(name = "membership_number", nullable = false, length = 50)
    private String membershipNumber;

    @Enumerated(EnumType.STRING)
    @Column(name = "status", nullable = false, length = 50)
    private MemberStatus status = MemberStatus.ACTIVE;

    @Column(name = "is_under_21", nullable = false)
    private boolean under21 = false;

    @Column(name = "prevention_officer", nullable = false)
    private boolean preventionOfficer = false;

    public UUID getClubId() { return clubId; }
    public void setClubId(UUID clubId) { this.clubId = clubId; }

    public String getFirstName() { return firstName; }
    public void setFirstName(String firstName) { this.firstName = firstName; }

    public String getLastName() { return lastName; }
    public void setLastName(String lastName) { this.lastName = lastName; }

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

    public LocalDate getDateOfBirth() { return dateOfBirth; }
    public void setDateOfBirth(LocalDate dateOfBirth) { this.dateOfBirth = dateOfBirth; }

    public LocalDate getMembershipDate() { return membershipDate; }
    public void setMembershipDate(LocalDate membershipDate) { this.membershipDate = membershipDate; }

    public String getMembershipNumber() { return membershipNumber; }
    public void setMembershipNumber(String membershipNumber) { this.membershipNumber = membershipNumber; }

    public MemberStatus getStatus() { return status; }
    public void setStatus(MemberStatus status) { this.status = status; }

    public boolean isUnder21() { return under21; }
    public void setUnder21(boolean under21) { this.under21 = under21; }

    public boolean isPreventionOfficer() { return preventionOfficer; }
    public void setPreventionOfficer(boolean preventionOfficer) { this.preventionOfficer = preventionOfficer; }
}
