<% /*
    $Revision$
    $Id$

    File:           model_ins_discipline.inc

    Description:    Vanuit CodeCharge gegenereerd model voor ins_discipline

    Context:

    Notes:
*/
%>
<!-- #include file="../api2/model_ins_disc_params.inc" -->
<%

function model_ins_discipline(disc_key, params)
{
    // Eén model voor de buitenwereld
    api2.merge_disc_params_model(this, _model_ins_discipline);

    this.REST_GET    = generic_REST_GET(_model_ins_discipline,  // Let op: de originele _model_ins_discipline
                                           { "GET": {
                                               wheres: [ "ins_tab_discipline.ins_discipline_module = 'INS'"
                                                       ]
                                               }
                                           }
                                       );
    this.REST_POST   = generic_REST_POST(_model_ins_discipline);
    this.REST_PUT    = generic_REST_PUT(_model_ins_discipline);
    this.REST_DELETE = generic_REST_DELETE(this, {});
}


_model_ins_discipline = // Internal only
{
    "table": "ins_tab_discipline",
    "primary": "ins_discipline_key",
    "records_name": "ins_disciplines",
    "record_name": "ins_discipline",
    "soft_delete": "ins_discipline_verwijder",
    "autfunction": "WEB_INSMGT",
    "record_title": L("ins_discipline"),
    "records_title": L("ins_discipline_m"),


    "fields": {
        "id": {
            "dbs": "ins_discipline_key",
            "label": "Key",
            "typ": "key",
            "required": true,
            "filter": "exact",
            "seq": "ins_s_ins_discipline_key"
        },
        "name": {
            "dbs": "ins_discipline_omschrijving",
            "label": L("ins_discipline_omschrijving"),
            "typ": "varchar",
            "translate": true,
            "required": true
        },
        "min_level": {
            "dbs": "ins_discipline_min_level",
            "label": L("ins_discipline_minlevel"),
            "typ": "key",
            "required": true,
            "LOV": L("ins_discipline_minlevelLOV")
        },
        "chargetype": {
            "dbs": "prs_kostensoort_key",
            "label": L("prs_kostensoort_key"),
            "typ": "key",
            "foreign": {
                "tbl": "PRS_KOSTENSOORT",
                "key": "PRS_KOSTENSOORT_KEY",
                "desc": "PRS_KOSTENSOORT_OMS"
            },
            "LOVinit": ""
        }
    },
    /* Velden van INS_DISC_PARAMS komen er dynamisch bij */
    "disc_params": {
        "model": model_ins_disc_params,
        "joinfield": "ins_discipline_key"
    }
}
%>