function LinhaModel(p) {
    "use strict";
    var mSelf = this,
        o = checkValue(p, {});

    ViewModelBase.apply(mSelf, arguments);

    mSelf.Show = ko.observable(true);

    mSelf.StatusCssClass = ko.computed(function () {
        if (mSelf.IsAtiva && mSelf.IsAtiva()) {
            return "item-linha-ativa";
        } else if (mSelf.IsEdicao && mSelf.IsEdicao()) {
            return "item-linha-edicao";
        }
        return "item-linha-inativa";
    }, mSelf);

    mSelf.podeSalvar = ko.computed(function () {
        var ret = true;

        ret &= mSelf.Identificador && mSelf.Identificador() != "" && mSelf.Identificador() != null;
        ret &= mSelf.Descricao && mSelf.Descricao() != "" && mSelf.Descricao() != null;

        return ret;
    }, mSelf);

    mSelf.podeAtivar = ko.computed(function () {
        var ret = false;

        ret = mSelf.podeSalvar();
        ret &= mSelf.Codigo && mSelf.Codigo() > 0;

        ret &= !mSelf.IsAtiva();
        //ret &= mSelf.VigenciaATE && mSelf.VigenciaATE() != null;

        return ret;
    }, mSelf);

    mSelf.salvar = function () {
//        var send = null,
//            removable = [
//                "salvar",
//                "__ko_mapping__"
//            ];

//        send = ko.toJS(mSelf);

//        ko.utils.arrayForEach(removable, function (remove) {
//            delete send[remove];
//        });
        
        return mSelf.clone();
    };

    mSelf.Ativar = function () {
        return mSelf.Codigo();
    };

    mSelf.mostrar = function () {
        mSelf.Visible(true);
    };

    mSelf.esconder = function () {
        mSelf.Visible(false);
    };

    mSelf.Show = ko.observable(true);

    mSelf.Visible = ko.observable(false);
}