package com.mvrent.carrental.model;

import jakarta.persistence.*;
import jakarta.validation.constraints.*;
import lombok.*;
import org.hibernate.annotations.ColumnDefault;

import java.math.BigDecimal;

/**
 * A third party that attaches cars/drivers to the fleet. Vendors get a scoped
 * /vendor portal login and earn revenue minus the organization's commission.
 */
@Entity
@Table(name = "vendors")
@Getter
@Setter
@NoArgsConstructor
@AllArgsConstructor
@Builder
public class Vendor {

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

    @NotBlank
    private String name;

    private String contactPerson;

    private String phone;

    @Email
    private String email;

    private String address;

    private String gstNumber;

    /** Free-text bank / settlement details. */
    private String settlementDetails;

    /** Per-vendor commission percent; overrides the global default when set. */
    private BigDecimal commissionPercent;

    @ColumnDefault("true")
    @Builder.Default
    private boolean active = true;
}
