#------------------------------------------------------------------------------
# File:         fotoware.config
#
# Description:  This config file defines Fotoware XMP tags for writing.
#
# Notes:        Length limits are imposed according to Fotoware limitations when
#               writing string values, but these may be disabled with the -n
#               option or by adding a "#" to the tag name.  However, beware that
#               longer strings may cause unpredictable results in Fotoware
#               software.
#
#               Use of this file will not bring full Fotoware 'experience'.
#               Fotostation writes these tags not only into XMP but also in IIM
#               and even Exif spaces.  Communication with older Fotoware systems
#               may be broken when using only XMP.
#
#               Also note that there are potential problems with character
#               encoding on systems with mixed environments, depending on
#               Fotoware software settings.
#
# Usage:        exiftool -config fotoware.config -FOTOWARETAG=VALUE FILE ...
#
# Requires:     ExifTool version 7.00 or later
#
# Revisions:    2012/09/19 - P. Harvey Created
#               2016/09/24 - Mikolaj Machowski updated with new Fotostation tags
#------------------------------------------------------------------------------

%Image::ExifTool::UserDefined = (
    'Image::ExifTool::XMP::Main' => {
        fwl => {
            SubDirectory => { TagTable => 'Image::ExifTool::UserDefined::fwl' },
        },
        fwr => {
            SubDirectory => { TagTable => 'Image::ExifTool::UserDefined::fwr' },
        },
        fwc => {
            SubDirectory => { TagTable => 'Image::ExifTool::UserDefined::fwc' },
        },
        fwu => {
            SubDirectory => { TagTable => 'Image::ExifTool::UserDefined::fwu' },
        },
    },
);

%Image::ExifTool::UserDefined::fwl = (
    GROUPS           => { 0 => 'XMP', 1 => 'XMP-fwl', 2 => 'Image' },
    NAMESPACE        => { 'fwl' => 'http://ns.fotoware.com/iptcxmp-legacy/1.0/' },
    WRITABLE         => 'string',
    # limit maximum lengths of string values
    CreatedTime      => { PrintConvInv => 'substr($val,0,16)' },
    EditStatus       => { PrintConvInv => 'substr($val,0,64)' },
    FixtureIdentifier=> { PrintConvInv => 'substr($val,0,1024)' },
    LocalCaption     => { PrintConvInv => 'substr($val,0,2000)' },
    ObjectCycle      => { PrintConvInv => 'substr($val,0,32)' },
    ProgramVersion   => { PrintConvInv => 'substr($val,0,10)' },
    ReferenceNumber  => { PrintConvInv => 'substr($val,0,256)' },
    ReferenceService => { PrintConvInv => 'substr($val,0,256)' },
    ReferenceDate    => {
        Groups => { 2 => 'Time' },
        Writable => 'date',
        Shift => 'Time',
        PrintConv => '$self->ConvertDateTime($val)',
        PrintConvInv => '$self->InverseDateTime($val,undef,1)',
    },
    ReleaseDate    => {
        Groups => { 2 => 'Time' },
        Writable => 'date',
        Shift => 'Time',
        PrintConv => '$self->ConvertDateTime($val)',
        PrintConvInv => '$self->InverseDateTime($val,undef,1)',
    },
    ReleaseTime      => { PrintConvInv => 'substr($val,0,16)' },
);

%Image::ExifTool::UserDefined::fwr = (
    GROUPS           => { 0 => 'XMP', 1 => 'XMP-fwr', 2 => 'Image' },
    NAMESPACE        => { 'fwr' => 'http://ns.fotoware.com/iptcxmp-reserved/1.0/' },
    WRITABLE         => 'string',
    Classify         => { PrintConvInv => 'substr($val,0,256)' },
    DocumentText     => { PrintConvInv => 'substr($val,0,2000)' },
    Exif             => { PrintConvInv => 'substr($val,0,1024)' },
    History          => { PrintConvInv => 'substr($val,0,256)' },
    ImageNotes       => { PrintConvInv => 'substr($val,0,256)' },
    JobId            => { PrintConvInv => 'substr($val,0,256)' },
    OwnerId          => { PrintConvInv => 'substr($val,0,256)' },
    ShortUniqeId     => { PrintConvInv => 'substr($val,0,256)' },
    ContentValue     => { PrintConvInv => 'substr($val,0,256)' },
    UniqueId         => { PrintConvInv => 'substr($val,0,256)' },
    MasterDocumentId => { PrintConvInv => 'substr($val,0,256)' },
);


%Image::ExifTool::UserDefined::fwc = (
    GROUPS        => { 0 => 'XMP', 1 => 'XMP-fwc', 2 => 'Image' },
    NAMESPACE     => { 'fwc' => 'http://ns.fotoware.com/iptcxmp-custom/1.0/' },
    WRITABLE      => 'string',
    # generate CustomField1 through CustomField20 tags
    map { 'CustomField' . $_ => {
        PrintConvInv => 'substr($val,0,256)',
    } } (1 .. 20),
);

%Image::ExifTool::UserDefined::fwu = (
    GROUPS        => { 0 => 'XMP', 1 => 'XMP-fwu', 2 => 'Image' },
    NAMESPACE     => { 'fwu' => 'http://ns.fotoware.com/iptcxmp-user/1.0/' },
    WRITABLE      => 'string',
    # generate UserDefined1 through UserDefined255 tags
    map { 'UserDefined' . $_ => {
        PrintConvInv => 'substr($val,0,256)',
    } } (1 .. 255),
);

1;  #end
