package com.ecep.contract.vm;

import com.ecep.contract.vo.ContractGroupVo;

import javafx.beans.property.SimpleStringProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;

@Data
@EqualsAndHashCode(callSuper = false)
public class ContractGroupViewModel extends IdentityViewModel<ContractGroupVo> {
    private SimpleStringProperty code = new SimpleStringProperty();
    private SimpleStringProperty name = new SimpleStringProperty();
    private SimpleStringProperty title = new SimpleStringProperty();

    @Override
    protected void updateFrom(ContractGroupVo v) {
        super.updateFrom(v);
        code.set(v.getCode());
        name.set(v.getName());
        title.set(v.getTitle());
    }

    @Override
    public boolean copyTo(ContractGroupVo v) {
        boolean result = super.copyTo(v);
        v.setCode(code.get());
        v.setName(name.get());
        v.setTitle(title.get());
        return result;
    }
}