package com.mvrent.carrental.web;

import com.mvrent.carrental.model.Vendor;

import java.math.BigDecimal;

/** Flat JSON view of a Vendor for the AJAX Manage Vendors screen. */
public record VendorDto(
        Long id,
        String name,
        String contactPerson,
        String phone,
        String email,
        String address,
        String gstNumber,
        String settlementDetails,
        BigDecimal commissionPercent,
        boolean active
) {
    public static VendorDto from(Vendor v) {
        return new VendorDto(
                v.getId(), v.getName(), v.getContactPerson(), v.getPhone(), v.getEmail(),
                v.getAddress(), v.getGstNumber(), v.getSettlementDetails(),
                v.getCommissionPercent(), v.isActive()
        );
    }
}
