package Orchard::DB::Schema::RoyaltyAccounting::PaymentGroupPaymentAccount;

use strict;
use warnings;

use lib '/var/app/orchard/collab/jgetter/perllib';
use base 'Orchard::DB::DBIxCore';

## table
__PACKAGE__->table('royalty_accounting.payment_group_payment_account');

## columns
__PACKAGE__->add_columns(
    'payment_group_payment_account_id' => {'is_auto_increment'=>1,'data_type'=>'mediumint','is_nullable'=>0},
    'payment_group_payment_id' => {'data_type'=>'mediumint','is_nullable'=>0},
    'prior_payment_group_payment_id' => {'data_type'=>'mediumint','is_nullable'=>1},
    'account_id' => {'data_type'=>'mediumint','is_nullable'=>0},
    'payoneer_program_id' => {'data_type'=>'int','is_nullable'=>0},
    'last_statement_period_id' => {'data_type'=>'mediumint','is_nullable'=>1},
    'current_statement_period_id' => {'data_type'=>'mediumint','is_nullable'=>0},
    'currency_code' => {'data_type'=>'char','is_nullable'=>0},
    'last_payment' => {'data_type'=>'decimal','is_nullable'=>0},
	'contracts_payable' => {'data_type'=>'json','is_nullable'=>1},
    'current_balance' => {'data_type'=>'decimal','is_nullable'=>0},
    'tax_withholding' => {'data_type'=>'decimal','is_nullable'=>1},
    'balance_after_tax' => {'data_type'=>'decimal','is_nullable'=>0},
    'note' => {'data_type'=>'varchar','is_nullable'=>1},
    'created_at' => {'data_type'=>'datetime','is_nullable'=>0},
    'created_by' => {'data_type'=>'varchar','is_nullable'=>0},
    'last_modified' => {'data_type'=>'datetime','is_nullable'=>0},
    'last_modified_by' => {'data_type'=>'varchar','is_nullable'=>0},
    'deleted_at' => {'data_type'=>'datetime','is_nullable'=>1},
    'deleted_by' => {'data_type'=>'varchar','is_nullable'=>1}
);

## primary key
__PACKAGE__->set_primary_key('payment_group_payment_account_id');

## unique key (payment_group_payment_id, account_id)
__PACKAGE__->add_unique_constraint('uidx_group_payment_account' => [qw/payment_group_payment_id account_id/]);

1;
