package com.ecep.contract.vm;

import com.ecep.contract.model.ContractType;

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

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

    private SimpleStringProperty catalog = new SimpleStringProperty();
    private SimpleStringProperty direction = new SimpleStringProperty();

    @Override
    protected void updateFrom(ContractType v) {
        super.updateFrom(v);
        code.set(v.getCode());
        name.set(v.getName());
        title.set(v.getTitle());
        catalog.set(v.getCatalog());
        direction.set(v.getDirection());
    }


    @Override
    public boolean copyTo(ContractType v) {
        boolean result = super.copyTo(v);
        v.setCode(code.get());
        v.setName(name.get());
        v.setTitle(title.get());
        v.setCatalog(catalog.get());
        v.setDirection(direction.get());
        return result;
    }
}
