# NEVER EDIT this file.  It was generated and will be overwritten without
# notice upon regeneration of this application.  You have been warned.
package JobAd::Model::job;
use strict; use warnings;

__PACKAGE__->load_components( qw/ PK::Auto Core / );
__PACKAGE__->table( 'job' );
__PACKAGE__->add_columns( qw/
    id
    title
    description
    created
    modified
    travel_percent
    on_site
    time_percent
/ );
__PACKAGE__->set_primary_key( 'id' );
__PACKAGE__->base_model( 'JobAd::Model' );
__PACKAGE__->has_many(
    job_skills => 'JobAd::Model::job_skill',
    'job'
);
__PACKAGE__->many_to_many(
    skills => 'job_skills',
    'skill'
);

sub get_foreign_display_fields {
    return [ qw( title ) ];
}

sub get_foreign_tables {
    return qw(
    );
}

sub foreign_display {
    my $self = shift;

    my $title = $self->title() || '';

    return "$title";
}

sub table_name {
    return 'job';
}

my %select_map_for = (
    on_site => {
        onsite => 'On-Site',
        parttele => 'Partial Telecommute',
        tele => 'Telecommute',
    },
    time_percent => {
        full => 'Full Time',
        part => 'Part Time',
        con => 'Contract',
    },
);

sub on_site_display {
    my $self = shift;
    return $select_map_for{ on_site }{ $self->on_site }
           || $self->on_site;
}

sub time_percent_display {
    my $self = shift;
    return $select_map_for{ time_percent }{ $self->time_percent }
           || $self->time_percent;
}


1;

=head1 NAME

JobAd::Model::GEN::job - model for job table (generated part)

=head1 DESCRIPTION

This model inherits from Gantry::Utils::DBIxClass.
It was generated by Bigtop, and IS subject to regeneration.

=head1 METHODS

You may use all normal Gantry::Utils::DBIxClass methods and the
ones listed here:

=over 4

=item get_foreign_display_fields

=item get_foreign_tables

=item foreign_display

=item table_name

=item on_site_display

=item time_percent_display

=back

=cut
