<% /*
    $Revision$
    $Id$

    File:           model_aut_sp.inc
    Description:
    Notes:
*/

%>
<!-- #include file="./model_aut_sp_map.inc" -->
<%
function model_aut_sp(params)
{
    params = params || {};
    this.records_name = "serviceproviders";
    this.record_name = "serviceprovider";
    this.table = "aut_sp";
    this.primary = "aut_sp_key";
    this.autfunction = params.internal?false:"WEB_FACTAB";
    this.record_title = L("aut_sp");
    this.records_title = L("aut_sp_m");

    this.fields = {
        "id": {
            "dbs": "aut_sp_key",
            "label": L("lcl_key"),
            "typ": "key",
            "seq": "aut_s_aut_sp_key"
        },
        "code": {
            "dbs": "aut_sp_code",
            "label": L("aut_sp_code"),
            "typ": "varchar"
        },
        "name": {
            "dbs": "aut_sp_omschrijving",
            "label": L("aut_sp_omschrijving"),
            "typ": "varchar",
            "required": true
        },
        "type": {
            "dbs": "aut_sp_type",
            "label": L("aut_sp_type"),
            "typ": "key",
            "required": true,
            "LOV": L("aut_sp_typeLOV") // TODO?
        },
        "remark": {
            "dbs": "aut_sp_opmerking",
            "label": L("aut_sp_opmerking"),
            "typ": "memo"
        },
        "secret": {
            "dbs": "aut_sp_secret",
            "label": L("aut_sp_secret"),
            "typ": "varchar",
            "defaultvalue": shared.random(32),
            "secret": true
        },
        "audience": {
            "dbs": "aut_sp_audience",
            "label": L("aut_sp_audience"),
            "typ": "varchar",
            "placeholder": customerId + ".facilitor.nl"
        },
        "redirecturi": {
            "dbs": "aut_sp_redirect_uri",
            "label": L("aut_sp_redirect_uri"),
            "typ": "varchar",
            "placeholder": customerId + ".facilitor.nl"
        },
        "issuer": {
            "dbs": "aut_sp_issuer",
            "label": L("aut_sp_issuer"),
            "typ": "varchar"
        },
        "algorithm": {
            "dbs": "aut_sp_algorithm",
            "label": L("aut_sp_algorithm"),
            "typ": "varchar"
        },
        "authorization": {
            "dbs": "fac_functie_key",
            "label": L("aut_sp_functie_key"),
            "typ": "key",
            "foreign": "fac_functie"
        },
        "loglevel": {
            "dbs": "aut_sp_loglevel",
            "label": L("aut_sp_loglevel"),
            "typ": "number",
            "required": "true",
            "defaultvalue": 0
        },
        "internal": {
            "dbs": "aut_sp_internal",
            "label": L("aut_sp_internal"),
            "typ": "check0",
            "readonly": true
        },
        "created": {
            "dbs": "aut_sp_aanmaak",
            "label": L("aut_sp_aanmaak"),
            "typ": "date",
            "readonly": true
        }
    }

    this.includes =
               {  "spmappings": { model: new model_aut_sp_map(),
                                  joinfield: "serviceprovider",
                                  enable_update: true
                                }
              };

    this.REST_GET    = generic_REST_GET(this);
    this.REST_POST   = generic_REST_POST(this);
    this.REST_PUT    = generic_REST_PUT(this);
    this.REST_DELETE = generic_REST_DELETE(this);
}
%>