package fr.marouse.entity;

import java.util.List;

import jakarta.persistence.CascadeType;
import jakarta.persistence.Column;
import jakarta.persistence.Entity;
import jakarta.persistence.GeneratedValue;
import jakarta.persistence.GenerationType;
import jakarta.persistence.Id;
import jakarta.persistence.ManyToMany;
import jakarta.persistence.OneToMany;
import jakarta.persistence.Table;

@Entity
@Table(name = "Compte")
public class Compte {
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Column(name = "numCompte")
    private int numCompte;

    @Column(name = "solde")
    private double solde;

    @Column(name = "typeCompte", nullable = false)
    private String typeCompte;

    @OneToMany(mappedBy = "compte", cascade = CascadeType.ALL)
    private List<Operation> operations;

    @ManyToMany(mappedBy = "comptes")
    private List<Client> clients;

    public Compte() {}
    public Compte(double solde, String typeCompte) {
        this.solde = solde;
        this.typeCompte = typeCompte;
    }

    public int getNumCompte() { return numCompte; }
    public double getSolde() { return solde; }
    public String getTypeCompte() { return typeCompte; }

    public void setNumCompte(int numCompte) {
        this.numCompte = numCompte;
    }

    public void setSolde(double solde) {
        this.solde = solde;
    }

    public void setTypeCompte(String typeCompte) {
        this.typeCompte = typeCompte;
    }

    public List<Operation> getOperations() {
        return operations;
    }

    public void setOperations(List<Operation> operations) {
        this.operations = operations;
    }

    public List<Client> getClients() {
        return clients;
    }

    public void setClients(List<Client> clients) {
        this.clients = clients;
    }
}