/* This file is part of AHD ID3 Tag Editor (AITE)
   A program can create and edit ID3 Tag for mp3 files

   Copyright © Ala I.Hadid 2012

   This program is free software: you can redistribute it and/or modify
   it under the terms of the GNU General Public License as published by
   the Free Software Foundation, either version 3 of the License, or
   (at your option) any later version.

   This program is distributed in the hope that it will be useful,
   but WITHOUT ANY WARRANTY; without even the implied warranty of
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
   GNU General Public License for more details.

   You should have received a copy of the GNU General Public License
   along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace AHD.ID3Tag.TextFrames
{
    public class TMED : TextFrame
    {
        public TMED()
            : base("TMED", 0, 0, null)
        { }
        public TMED(int size, ushort flags, byte[] data)
            : base("TMED", size, flags, data)
        { }
        public override TextFrameType FrameType
        {
            get
            {
                return TextFrameType.TypeOfTypesNotEditable;
            }
        }
        public override string Name
        {
            get { return "Media type"; }
        }
        string[] codes = 
        {
        "DIG",
    "DIG/A",

"ANA",
   "ANA/WAC",
   "ANA/8CA",

"CD",
     "CD/A",
    "CD/DD",
    "CD/AD",
    "CD/AA",

"LD",
     "LD/A",

"TT",
    "TT/33",
    "TT/45",
    "TT/71",
    "TT/76",
    "TT/78",
    "TT/80",

"MD",
     "MD/A",

"DAT",
     "DAT/A",
     "DAT/1",
     "DAT/2",
     "DAT/3",
     "DAT/4",
    "DAT/5",
     "DAT/6",

"DCC",
     "DCC/A",

"DVD",
     "DVD/A",

"TV",
   "TV/PAL",
  "TV/NTSC",
 "TV/SECAM",

"VID",
   "VID/PAL",
  "VID/NTSC",
 "VID/SECAM",
   "VID/VHS",
  "VID/SVHS",
  "VID/BETA",

"RAD",
    "RAD/FM",
    "RAD/AM",
    "RAD/LW",
    "RAD/MW",

"TEL",
     "TEL/I",

"MC",
     "MC/4",
     "MC/9",
     "MC/I",
    "MC/II",
   "MC/III",
    "MC/IV",

"REE",
     "REE/9",
    "REE/19",
    "REE/38",
   "REE/76",
     "REE/I",
    "REE/II",
   "REE/III",
    "REE/IV",
        };
        public override string Text
        {
            get
            {
                for (int i = 0; i < codes.Length; i++)
                {
                    if (base.Text == codes[i])
                    {
                        return Consts.MediaTypes[i];
                    }
                }
                return base.Text;
            }
            set
            {
                for (int i = 0; i < Consts.MediaTypes.Length; i++)
                {
                    if (value == Consts.MediaTypes[i])
                    {
                        base.Text = codes[i];
                        return;
                    }
                }
                base.Text = "";
            }
        }
    }
}
