text: # Copyright (C) 2019 Google Inc.
  # Licensed under http://www.apache.org/licenses/LICENSE-2.0 <see LICENSE file>
  
  """Program model."""
  from ggrc import db
  from ggrc.fulltext.mixin import Indexed
  from ggrc.access_control.roleable import Roleable
  from ggrc.models.context import HasOwnContext
  from ggrc.models import mixins
  from ggrc.models.mixins import base
  from ggrc.models.deferred import deferred
  from ggrc.models import object_document
  from ggrc.models.object_person import Personable
  from ggrc.models import reflection
  from ggrc.models import review
  from ggrc.models.relationship import Relatable
  
  
  class Program(review.Reviewable,
                mixins.CustomAttributable,
                object_document.PublicDocumentable,
                Roleable,
                Personable,
                Relatable,
                HasOwnContext,
                mixins.LastDeprecatedTimeboxed,
                base.ContextRBAC,
                mixins.BusinessObject,
                mixins.Folderable,
                Indexed,
                db.Model):
    """Representation for Program model."""
    __tablename__ = 'programs'
  
    KINDS = ['Directive']
    KINDS_HIDDEN = ['Company Controls Policy']
  
    kind = deferred(db.Column(db.String), 'Program')
  
    audits = db.relationship(
        'Audit', backref='program', cascade='all, delete-orphan')
  
    _api_attrs = reflection.ApiAttributes(
        'kind',
        reflection.Attribute('audits', create=False, update=False),
        reflection.Attribute('risk_assessments', create=False, update=False),
    )
    _include_links = []
    _aliases = {
        "documents_file": None,
        "owners": None
    }
  
    @classmethod
    def eager_query(cls):
      from sqlalchemy import orm
  
      query = super(Program, cls).eager_query()
      return cls.eager_inclusions(query, Program._include_links).options(
          orm.subqueryload('audits'),
          orm.subqueryload('risk_assessments'),
      )
  