package cn.ibizlab.codegen.model;

import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
import lombok.experimental.Accessors;
import net.ibizsys.model.service.IPSSubSysServiceAPIDERS;

@Getter
@Setter
@NoArgsConstructor
@Accessors(chain = true)
public class ClientEntityRSModel extends BaseModel {

    public ClientEntityRSModel(ClientModel clientModel, IPSSubSysServiceAPIDERS iPSSubSysServiceAPIDERS) {
        this.opt = iPSSubSysServiceAPIDERS;
        this.clientModel = clientModel;
        this.setCodeName(iPSSubSysServiceAPIDERS.getCodeName());
        this.setName(iPSSubSysServiceAPIDERS.getName());
    }

    private ClientModel clientModel;

    public String getParentIdFieldCodeName() {
//        if (getPSDEServiceAPIRS().getParentIdPSDEField() != null)
//            return getPSDEServiceAPIRS().getParentIdPSDEField().getCodeName();
        return "";
    }

    public int getParentIdFieldType() {
//        if (getPSDEServiceAPIRS().getParentIdPSDEField() != null)
//            return getPSDEServiceAPIRS().getParentIdPSDEField().getStdDataType();
        return PropType.VARCHAR.code;
    }

    public String getMajorEntityCodeName() {
        return getPSDEServiceAPIRS().getMajorPSSubSysServiceAPIDE().getCodeName();
    }

    public boolean isMajorEntityMajor() {
        return getPSDEServiceAPIRS().getMajorPSSubSysServiceAPIDE().isMajor();
    }


    public String getMinorEntityCodeName() {
        return getPSDEServiceAPIRS().getMinorPSSubSysServiceAPIDE().getCodeName();
    }


    private IPSSubSysServiceAPIDERS getPSDEServiceAPIRS() {
        return (IPSSubSysServiceAPIDERS) opt;
    }
}
