ScheduledReport:
  columns:
    emails:      { type: string(1000) }
    tipo:        { type: string(125) }
    frecuencia:  { type: string(125) }
    is_active:   { type: boolean, default: false }
    created_at:  { type: timestamp }

Documentation:
  columns:
    multimedia_id:  { type: integer, primary: false }
    rank:           { type: integer, primary: false, default: 0 }
  relations:
    Multimedia:     { onDelete: CASCADE, local: multimedia_id, foreign: id, foreignAlias: Documentation }

About:
  columns:
    multimedia_id:  { type: integer, primary: false }
    rank:           { type: integer, primary: false, default: 0 }
  relations:
    Multimedia:     { onDelete: CASCADE, local: multimedia_id, foreign: id, foreignAlias: Abouts }

Instructions:
  columns:
    multimedia_id:  { type: integer, primary: false }
    rank:           { type: integer, primary: false, default: 0 }
  relations:
    Multimedia:     { onDelete: CASCADE, local: multimedia_id, foreign: id, foreignAlias: Instructions }

Variables:
  columns:
    slug:           { type: string(255) }
    value:          { type: string(511) }
    description:    { type: string(1000) }

Piece:
  actAs:
    I18n:
      fields:       [name, description]
  columns:
    rank:           { type: integer, primary: false }
    color:          { type: string(25) }
    num_categories:  { type: integer }
    name:           { type: string(255) }
    description:    { type: string(1000) }

PieceLevel:
  columns:
    piece_id:       { type: integer, primary: false }
    level_id:       { type: integer, primary: false }
  relations:
    Piece:          { onDelete: CASCADE, local: piece_id, foreign: id, foreignAlias: PieceLevel }
    Level:          { onDelete: CASCADE, local: level_id, foreign: id, foreignAlias: PieceLevel }

Category:
  actAs:
    I18n:
      fields:       [name, description]
  columns:
    piece_id:       { type: integer, primary: false }
    multimedia_id:  { type: integer, primary: false }
    name:           { type: string(255) }
    description:    { type: string(1000) }
    num_questions:  { type: integer, primary: false, default: 1 }
  relations:
    Piece:          { onDelete: CASCADE, local: piece_id, foreign: id, foreignAlias: Categories }
    Multimedia:     { onDelete: SET NULL, local: multimedia_id, foreign: id, foreignAlias: Questions }

Profile:
  actAs:
    I18n:
      fields:       [name, description]
  columns:
    rank:           { type: integer, primary: false }
    name:           { type: string(255) }
    description:    { type: string(1000) }
    activated:      { type: boolean, default: false }

ProfilePlayer:
  columns:
    profile_id:     { type: integer, primary: false }
    player_id:      { type: integer, primary: false }
  relations:
    Profile:        { onDelete: SET NULL, local: profile_id, foreign: id, foreignAlias: ProfilePlayer }
    Player:         { onDelete: SET NULL, local: player_id, foreign: id, foreignAlias: ProfilePlayer }

ProfilePiece:
  columns:
    profile_id:     { type: integer, primary: false }
    piece_id:       { type: integer, primary: false }
  relations:
    Profile:        { onDelete: SET NULL, local: profile_id, foreign: id, foreignAlias: ProfilePlayer }
    Piece:          { onDelete: SET NULL, local: piece_id, foreign: id, foreignAlias: ProfilePlayer }

Player:
  actAs:
    Timestampable:  ~
  columns:
    zone_id:              { type: integer, primary: false }
    event_id:             { type: integer, primary: false }
    administrator_id:     { type: integer, primary: false }
    custom1_id:           { type: integer, primary: false }
    custom2_id:           { type: integer, primary: false }
    custom3_id:           { type: integer, primary: false }
    name:                 { type: string(255), notnull: true }
    surname:              { type: string(255) }
    remote_id:            { type: string(50), unique: true }
    email:                { type: string(150), email: true, unique: true }
    is_active:            { type: boolean, default: true }
    is_sign_up:           { type: boolean, default: false }
    first_login:          { type: timestamp }
    last_login:           { type: timestamp }
    has_completed:        { type: boolean, default: false }
    date_has_completed:   { type: timestamp }
    culture:              { type: string(5), default: es }
  relations:
    Zone:                 { onDelete: SET NULL, local: zone_id, foreign: id, foreignAlias: Players }
    Event:                { onDelete: SET NULL, local: event_id, foreign: id, foreignAlias: Players }
    Administrator:        { onDelete: SET NULL, local: administrator_id, foreign: id, foreignAlias: Players }
    Custom1:              { onDelete: SET NULL, local: custom1_id, foreign: id, foreignAlias: Players }
    Custom2:              { onDelete: SET NULL, local: custom2_id, foreign: id, foreignAlias: Players }
    Custom3:              { onDelete: SET NULL, local: custom3_id, foreign: id, foreignAlias: Players }

Question:
  actAs:
    I18n:
      fields:               [name, question, question_data]
  columns:
    piece_id:               { type: integer, primary: false }
    type:                   { type: string(20) }
    category_id:            { type: integer, primary: false }
    multimedia_id:          { type: integer, primary: false }
    name:                   { type: string(150) }
    question:               { type: string(1000) }
    exercise_type:          { type: string(20) }
    question_data:          { type: string(1000) }
    feedback_ok:            { type: integer, primary: false }
    feedback_error:         { type: integer, primary: false }
    feedback_time:          { type: integer, primary: false }
    rank:                   { type: integer, primary: false }
  relations:
    Piece:                  { onDelete: CASCADE, local: piece_id, foreign: id, foreignAlias: Questions }
    Category:               { onDelete: SET NULL, local: category_id, foreign: id, foreignAlias: Questions }
    Multimedia:             { onDelete: SET NULL, local: multimedia_id, foreign: id, foreignAlias: Questions }
    Feedback:               { onDelete: SET NULL, local: feedback_ok, foreign: id, foreignAlias: Questions }
    Feedback:               { onDelete: SET NULL, local: feedback_error, foreign: id, foreignAlias: Questions }
    Feedback:               { onDelete: SET NULL, local: feedback_time, foreign: id, foreignAlias: Questions }

QuestionOption:
  actAs:
    I18n:
      fields:               [content, feedback, option_data]
  columns:
    question_id:  { type: integer, primary: false }
    content:      { type: string(1000) }
    feedback:     { type: string(1000) }
    is_correct:   { type: boolean, default: false }
    rank:         { type: integer, primary: false }
    option_data:  { type: string(1000) }
  relations:
    Question:     { onDelete: CASCADE, local: question_id, foreign: id, foreignAlias: QuestionOptions }

Feedback:
  actAs:
    I18n:
      fields:               [texto]
  columns:
    texto:                  { type: string(1000) }
    predeterminado:         { type: boolean, default: false }
    type:                   { type: string(150) }

Game:
  columns:
    player_id:          { type: integer, primary: false }
    profile_player_id:  { type: integer, primary: false }
    zone_id:            { type: integer, primary: false }
    event_id:           { type: integer, primary: false }
    custom1_id:         { type: integer, primary: false }
    custom2_id:         { type: integer, primary: false }
    custom3_id:         { type: integer, primary: false }
    num_answers_ok:     { type: integer, primary: false, default: 0 }
    num_answers_error:  { type: integer, primary: false, default: 0 }
    points:             { type: double,  primary: false, default: 0 }
    is_completed:       { type: boolean, default: false }
    date_started:       { type: timestamp }
    date_completed:     { type: timestamp }
    rank_player:        { type: integer, primary: false }
    rank_general:       { type: integer, primary: false }
    rank_zone:          { type: integer, primary: false }
    rank_event:         { type: integer, primary: false }
    rank_custom1:       { type: integer, primary: false }
    rank_custom2:       { type: integer, primary: false }
    rank_custom3:       { type: integer, primary: false }
    initial_level:      { type: integer, primary: false }
    level_id:           { type: integer, primary: false }
  relations:
    Player:             { onDelete: CASCADE, local: player_id, foreign: id, foreignAlias: Games }
    ProfilePlayer:      { onDelete: CASCADE, local: profile_player_id, foreign: id, foreignAlias: Games }
    Zone:               { onDelete: CASCADE, local: zone_id, foreign: id, foreignAlias: Games }
    Event:              { onDelete: CASCADE, local: event_id, foreign: id, foreignAlias: Games }
    Custom1:            { onDelete: CASCADE, local: custom1_id, foreign: id, foreignAlias: Games }
    Custom2:            { onDelete: CASCADE, local: custom2_id, foreign: id, foreignAlias: Games }
    Custom3:            { onDelete: CASCADE, local: custom3_id, foreign: id, foreignAlias: Games }
    Level:              { onDelete: CASCADE, local: level_id, foreign: id, foreignAlias: Games }

Level:
  actAs:
    I18n:
      fields:               [name]
  columns:
    name:               { type: string(1000) }
    level:              { type: integer, primary: false }
    Points:             { type: integer, primary: false }

Answer:
  columns:
    game_id:            { type: integer, primary: false }
    question_id:        { type: integer, primary: false }
    question_option_id: { type: integer, primary: false }
    points:             { type: float, primary: false, default: 0 }
    is_completed:       { type: boolean, default: false }
    is_correct:         { type: boolean, default: false }
    date_started:       { type: timestamp }
    date_completed:     { type: timestamp }
    duration:           { type: integer, primary: false, default: 0 }
    culture:            { type: string(10) }
    calculated_type:    { type: string(20) }
    level:              { type: integer, notnull: true, default: 1 }
  relations:
    Game:               { onDelete: CASCADE, local: game_id, foreign: id, foreignAlias: Answers }
    Question:           { onDelete: CASCADE, local: question_id, foreign: id, foreignAlias: Answers }
    QuestionOption:     { onDelete: CASCADE, local: question_option_id, foreign: id, foreignAlias: Answers }

Multimedia:
  actAs:
    I18n:
      fields:               [url]
  columns:
    url:                    { type: string(1000) }
    type:                   { type: string(50) }
    rank:                   { type: integer, primary: false }

QuestionMultimedia:
  columns:
    question_id:            { type: integer, primary: false }
    multimedia_id:          { type: integer, primary: false }
  relations:
    Question:               { onDelete: CASCADE, local: question_id, foreign: id, foreignAlias: QuestionMultimedias }
    Multimedia:             { onDelete: CASCADE, local: multimedia_id, foreign: id, foreignAlias: QuestionMultimedias }

GameMultimedia:
  columns:
    game_id:                { type: integer, primary: false }
    multimedia_id:          { type: integer, primary: false }
    culture:                { type: string(10) }
    num_file_downloads:     { type: integer, primary: false, default: 0 }
    num_video0:             { type: integer, primary: false, default: 0 }
    num_video25:            { type: integer, primary: false, default: 0 }
    num_video50:            { type: integer, primary: false, default: 0 }
    num_video75:            { type: integer, primary: false, default: 0 }
    num_video100:           { type: integer, primary: false, default: 0 }
    date_file_first:        { type: timestamp }
    date_file_last:         { type: timestamp }
    date_video_first:       { type: timestamp }
    date_video_last:        { type: timestamp }
  relations:
    Game:                   { onDelete: CASCADE, local: game_id, foreign: id, foreignAlias: GameMultimedias }
    Multimedia:             { onDelete: CASCADE, local: multimedia_id, foreign: id, foreignAlias: GameMultimedias }

Administrator:
  actAs:
    Timestampable:    ~
  columns:
    name:             { type: string(255), notnull: true }
    surname:          { type: string(255) }
    email:            { type: string(150), notnull: true, unique: true }
    password:         { type: string(128), notnull: true }
    algorithm:        { type: string(128), default: sha1, notnull: true }
    salt:             { type: string(128) }
    token:            { type: string(255), notnull: true, unique: true }
    is_active:        { type: boolean, default: false }
    last_login:       { type: timestamp }
    credentials:      { type: string(100) }
    is_tutor:         { type: boolean, default: false }
    avatar_min:       { type: string(255) }
    avatar_med:       { type: string(255) }
    avatar_max:       { type: string(255) }
    biography:        { type: string(1000) }
    url_web:          { type: string(255) }

AdministratorSession:
  actAs:
    Timestampable:          ~
  columns:
    administrator_id:       { type: integer, primary: false }
    ip:                     { type: string(50) }
    user_agent:             { type: string(1000) }
    accept_language:        { type: string(255), notnull: true }
    date_logout:            { type: timestamp }
  relations:
    Administrator:          { onDelete: SET NULL, local: administrator_id, foreign: id, foreignAlias: Administrators }

User:
  actAs:
    Timestampable:    ~
  columns:
    player_id:         { type: integer, primary: false }
    name:              { type: string(255), notnull: true }
    surname:           { type: string(255) }
    email:             { type: string(150), notnull: true, unique: true }
    password:          { type: string(128), notnull: true }
    algorithm:         { type: string(128), default: sha1, notnull: true }
    salt:              { type: string(128) }
    token:             { type: string(255), notnull: true, unique: true }
    is_active:         { type: boolean, default: false }
    last_login:        { type: timestamp }
    credentials:       { type: string(100) }
    is_tutor:          { type: boolean, default: false }
    avatar_min:        { type: string(255) }
    avatar_med:        { type: string(255) }
    avatar_max:        { type: string(255) }
    biography:         { type: string(1000) }
    url_web:           { type: string(255) }
    pass_change_date:  { type: timestamp }
    pass_change_token: { type: string(255) }
  relations:
    Player:            { onDelete: CASCADE, local: player_id, foreign: id, foreignAlias: User }

UserSession:
  actAs:
    Timestampable:          ~
  columns:
    User_id:          { type: integer, primary: false }
    ip:               { type: string(50) }
    user_agent:       { type: string(1000) }
    accept_language:  { type: string(255), notnull: true }
    date_logout:      { type: timestamp }
  relations:
    User:             { onDelete: SET NULL, local: user_id, foreign: id, foreignAlias: UserSession }

Zone:
  actAs:
    I18n:
      fields:       [name]
  columns:
    country:        { type: string(10) }
    iso_code:       { type: string(10) }
    remote_id:      { type: string(20) }
    name:           { type: string(100) }
    is_special:     { type: boolean, default: false }

Event:
  columns:
    name:           { type: string(255) }
    description:    { type: string(1000) }
    remote_id:      { type: string(20) }
    is_active:      { type: boolean, default: true }

Custom1:
  actAs:
    I18n:
      fields:       [name, description]
  columns:
    rank:           { type: integer, primary: false }
    name:           { type: string(255) }
    description:    { type: string(1000) }

Custom2:
  actAs:
    I18n:
      fields:       [name, description]
  columns:
    rank:           { type: integer, primary: false }
    name:           { type: string(255) }
    description:    { type: string(1000) }

Custom3:
  actAs:
    I18n:
      fields:       [name, description]
  columns:
    rank:           { type: integer, primary: false }
    name:           { type: string(255) }
    description:    { type: string(1000) }

Configuration:
  actAs:
    I18n:
      fields:             [plain_text, long_text_wiki, long_text_html, file_name, file_mime_type, file_size]
  columns:
    type:                 { type: string(20) }
    is_visible:           { type: boolean, notnull: true, default: 1 }
    name:                 { type: string(255) }
    description:          { type: string(1000) }
    slug:                 { type: string(100) }
    category:             { type: string(100) }
    number:               { type: float, notnull: true, default: 0.0 }
    number_min:           { type: float, notnull: true, default: 0.0 }
    number_max:           { type: float, notnull: true, default: 0.0 }
    date_from:            { type: timestamp }
    date_to:              { type: timestamp }
    plain_text:           { type: string(1000) }
    long_text_wiki:       { type: string(5000) }
    long_text_html:       { type: string(5000) }
    is_checked:           { type: boolean, notnull: true, default: false }
    file_name:            { type: string(100) }
    file_mime_type:       { type: string(20) }
    file_size:            { type: integer, primary: false }

GameConfiguration:
  columns:
    game_id:                { type: integer, primary: false }
    configuration_id:       { type: integer, primary: false }
    culture:                { type: string(10) }
    num_file_downloads:     { type: integer, primary: false, default: 0 }
    num_video0:             { type: integer, primary: false, default: 0 }
    num_video25:            { type: integer, primary: false, default: 0 }
    num_video50:            { type: integer, primary: false, default: 0 }
    num_video75:            { type: integer, primary: false, default: 0 }
    num_video100:           { type: integer, primary: false, default: 0 }
    date_file_first:        { type: timestamp }
    date_file_last:         { type: timestamp }
    date_video_first:       { type: timestamp }
    date_video_last:        { type: timestamp }
  relations:
    Game:                   { onDelete: CASCADE, local: game_id, foreign: id, foreignAlias: GameConfigurations }
    Configuration:          { onDelete: CASCADE, local: configuration_id, foreign: id, foreignAlias: GameConfigurations }
    
Challenge:
  columns:
    player1_id:             { type: integer, primary: false }
    player2_id:             { type: integer, primary: false }
    date_started:           { type: timestamp }
    date_finished:          { type: timestamp }
    winner_id:              { type: integer, primary: false }
    status:                 { type: string(50) }
    points_player1:         { type: integer, primary: false }
    points_player2:         { type: integer, primary: false }
  relations:
    Player_2:               { onDelete: CASCADE, local: player1_id, foreign: id, foreignAlias: Challenges, class: Player }
    Player_3:               { onDelete: CASCADE, local: player2_id, foreign: id, foreignAlias: Challenges, class: Player }
    Player:                 { onDelete: SET NULL, local: winner_id, foreign: id, foreignAlias: Challenges }

ChallengeAnswer:
  columns:
    challenge_id:           { type: integer, primary: false }
    answer_id:              { type: integer, primary: false }
    miliseconds:            { type: integer, primary: false }
  relations:
    Challenge:              { onDelete: CASCADE, local: challenge_id, foreign: id, foreignAlias: ChallengeAnswers }
    Answer:                 { onDelete: CASCADE, local: answer_id, foreign: id, foreignAlias: ChallengeAnswers }

Glosary:
  actAs:
    I18n:
      fields:               [name, description, example]
  columns:
   name:                    { type: string(255) }
   description:             { type: string(1000) }
   example:                 { type: string(1000) }
   active:                  { type: boolean, default: true }
   letter:                  { type: string(1) }

ForumTitle:
  actAs:
    I18n:
      fields:               [title]
  columns:
    title:                  { type: string(1000) }
    active:                 { type: boolean, default: false }
    
ForumMessage:
  actAs:
    I18n:
      fields:               [message]
  columns:
    title_id:               { type: integer, primary: false }
    message:                { type: string(1000) }
    player_id:              { type: integer, primary: false }
    active:                 { type: boolean, default: false }
    date:                   { type: timestamp }
  relations:
    ForumTitle:             { onDelete: CASCADE, local: title_id, foreign: id, foreignAlias: ForumMessages }
    Player:                 { onDelete: SET NULL, local: player_id, foreign: id, foreignAlias: Player }
